title: Setfocus to textbox from JavaScript after just creating the textbox with JavaScript?
body: <p>So I just created a textbox with JavaScript like this:</p>
  
  <p><strong>EDIT: Added the len variable</strong></p>
  
  <pre><code>var len = tbl.rows.length;
                       var rtb = tbl.insertRow(len);
                       var cName = rtb.insertCell(0);
                       var cDis = rtb.insertCell(1);
                       var cDur = rtb.insertCell(2);
                       cName.innerHTML = '&lt;input type="text"  name="tbName1' + len + '" value="' + selected_text + '" &gt;';
                       cDis.innerHTML = '&lt;input type="text" name="tbDis1' + len + '" id="tbDis1' + len + '" &gt;';
                       cDur.innerHTML = '&lt;input type="text"  name="tbDur1' + len + '" &gt;';
                       var txtBox = document.getElementById('tbDist1' + len);
                       txtBox.focus();
  </code></pre>
  
  <p><strong>EDIT:Changed the second to last line.</strong> Still get this error: txtBox is null
   txtBox.focus();</p>
  
  <p>The last line isn't working.  After I create the textbox, I can't set focus to it.  Is there any way of doing so?</p>