javascript - focus isnt working for text field -


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 text in field

x = document.getelementbyid('ctl00_maincontent_mapusercontrol_6551_edit_artintheparkssculpturelocations_32_id') x.value ="bla"; 

however can't update focus...

x.focus(); 

returns undefined expected nothing happens text field. have tried autofocus, , grabbin element jquery instead of js.... still no joy...any idea why?

have faced similar issue. calling focus through settimeout need.

settimeout(function() { x.focus()}, 1); 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -