title: How to prevent '0' to be the first char entered in a textbox
body: <p>How to easily prevent <code>0</code> from being the first char entered in a textbox with JavaScript? I want something like the .Net <code>OnKeyDown()</code>. When the user presses <kbd>0</kbd> key for the first char to be prevented</p>
  
  <pre><code>e.Handled = true;
  </code></pre>
  
  <hr>
  
  <p>Why doesnt this work?</p>
  
  <pre><code>function PreventFirstCharZero()
  {
  var TB = document.getElementById("idbox").value;
  var TextLength = TB.value.length;
  
  if (48 == event.keyCode &amp;&amp; 0 == TextLength)
  {
      event.preventDefault();
  }
  }
  </code></pre>
  
  <hr>
  
  <p>This doesn't work</p>
  
  <pre><code>function PreventFirstCharZero()
  {
      if ('0' == document.getElementById("idbox")[0].value)
      {
          event.preventDefault();
      }
  }
  </code></pre>