how to set cursor to input box in javascript? -


document.getelementbyid(frmobj.id).value=""; document.getelementbyid(frmobj.id).autofocus; document.getelementbyid("errormsg").innerhtml = "only numeric value allowed"; 

in above code value of form object setting "" there no cursor in text box. want cursor there. focus() focuses input box not set cursor.

in javascript first focus on control , select control display cursor on texbox...

document.getelementbyid(frmobj.id).focus(); document.getelementbyid(frmobj.id).select(); 

or using jquery

$("#textboxid").focus(); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -