title: How can I set focus on an element in an HTML form using JavaScript?
body: <p>I have a web form with a text box in it. How do I go about setting focus to the text box by default?</p>
  <p>Something like this:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;body onload='setFocusToTextBox()'&gt;
  </code></pre>
  <p>so can anybody help me with it? I don't know how to set focus to the text box with JavaScript.</p>
  <pre class="lang-html prettyprint-override"><code>&lt;script&gt;
    function setFocusToTextBox(){
      //What to do here
    }
  &lt;/script&gt;
  </code></pre>