views:

18

answers:

1

I have a dynamic web page that after clicking a link, I insert a partial view into my page using brailjs action. My brailjs view looks like this

page.inserthtml('bottom', 'items', { @partial: 'item/_fields_replacement_part' })
page.replacehtml('add_item_link', { @partial: 'item/_addlink_replacement_part' })

After I insert the html, I want to be able set focus to one of the textboxes that was just inserted. How can I do that?

A: 

Say you have this js function:

function setFocus(id) {
   document.getElementById(id).focus();
}

You can call it from brailjs like this:

page.call('setFocus', 'myElementId');
Mauricio Scheffer