title: How to set the cursor in text box on page init
body: <p>I am doing a mobile application in jquery mobile. When the first page is loading it have an init function. My requirement is that when the first page is loaded the cursor should point to the text box. I tried:</p>
  
  <pre><code>  $('#txtdemo').focus();
  </code></pre>
  
  <p>and</p>
  
  <pre><code>   var txtBox=document.getElementById("txtdemo");
     txtBox.focus();
  </code></pre>
  
  <p>but both are not working. Please let me know a good approach to do this.</p>