document.getElementById(frmObj.id).value="";
document.getElementById(frmObj.id).autofocus;
document.getElementById("errorMsg").innerHTML = "Only numeric value is allowed";
In the above code the value of the form object is perfectly setting to ""
but there is no cursor in the text box. I want a cursor to be there. focus()
only focuses that input box but does not actually set the cursor.
document.getElementById(fieldID).focus();
should put the blinking cursor in the form field unless you have something else that grabs the focus on the page. The statement with .autofocus you have now does nothing.focus()
does set cursor. This is the whole meaning of the focus action.