Reputation: 3945
Source ->
<input name="ctl00$MainContent$MapUserControl$6551_Edit_artintheparkssculpturelocations_32_id" type="text" maxlength="50" id="ctl00_MainContent_MapUserControl_6551_Edit_artintheparkssculpturelocations_32_id" onchange="MaxLength(50, this, 'id')" class="control-label form-control" id2="6551_Edit_artintheparkssculpturelocations_32_id">
I can update the text in the field by
x = document.getElementById('ctl00_MainContent_MapUserControl_6551_Edit_artintheparkssculpturelocations_32_id')
x.value ="bla";
However I can't update the focus...
x.focus();
returns undefined as expected but nothing happens the text field. I have also tried autofocus, and grabbin the element with Jquery instead of JS.... Still no joy...any idea why?
Upvotes: 0
Views: 69
Reputation: 1343
Hey you need to trigger that event by using following code
x.trigger('focus');
Upvotes: 0
Reputation: 146
Have faced similar issue. Calling focus through setTimeOut is what you need.
setTimeout(function() { x.focus()}, 1);
Upvotes: 1