title: How to set cursor to input box in Javascript?
body: <pre><code>document.getElementById(frmObj.id).value="";
  document.getElementById(frmObj.id).autofocus;
  document.getElementById("errorMsg").innerHTML = "Only numeric value is allowed";
  </code></pre>
  
  <p>In the above code the value of the form object is perfectly setting to <code>""</code> but there is no cursor in the text box. I want a cursor to be there. <code>focus()</code> only focuses that input box but does not actually set the cursor.</p>