title: How to remove the leading zero from number using jQuery?
body: <p>I use this pattern to check for numbers only in a quantity field from 0 to whatever. how can I make the code not allow 012, 010.. etc I mean the starting zero, but still allow 0 as standalone number.</p>
  
  <p>0, 1, 10, 1, etc. are ok,</p>
  
  <p>but not allow 012, 005, etc.</p>
  
  <p>Is there a pattern that does that?</p>
  
  <p>Here is my code but the problem with it, it removes the 0, even if it is not leading in number which I want to avoid. I want to allow the 0 as standalone number in my field.</p>
  
  <pre><code>$('.td-qnt input').live('change keyup blur', function(e) {
      var re = /^[0-9]\d*$/;
      var str = $(this).val();
      $(this).val(str.replace(/^[ 0]/g,''));
      if (re.test(str)){
          var price = $(this).parent().parent().prev('td').html();
          var realprice = price.replace(/[^0-9\.]/g,'');  
          var result = realprice * str;
          var subtotal = result.toFixed(2);
          $(this).parent().parent().next('td').html('$'+subtotal);
      } else {
          $(this).parent().parent().next('td').html('$0.00');
          $(this).val('');
      }
  });
  </code></pre>