title: trying to set focus on a hidden text box
body: <p>I am trying to set focus on a hidden text box. I want that when the body or div containing the text box loads the focus should be on the particular text box so that any input from key board or any other device is caught by this element. I have tried the following code with no effect:</p>
  
  <pre><code>&lt;body&gt;
      &lt;input type="text" id="exp" maxlength="16"&gt;&lt;/input&gt;
      &lt;input type="text" id="exp2" maxlength="16"&gt;&lt;/input&gt;
      &lt;script&gt;
          $("#exp").hide();
          $("#exp").focus();
          $("#exp2").keypress(function(){
              alert($("#exp").val());
          });
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>make any suggestions. jquery solution will be preferred.</p>