title: Allowing only numbers and decimal point with negative value and only two digit
body: <p>I want to keep the input value limited to number(including -ve integers) and limit decimals to 2 digit.</p>
  
  <p>Accept:</p>
  
  <pre><code>22.33; -123.45; 0.22
  </code></pre>
  
  <p>Reject:</p>
  
  <pre><code>-123.000123; --123.000123; -123-23.12; --23-1.00
  </code></pre>
  
  <p>I'm using this </p>
  
  <pre><code>&lt;input id="restricted" type="text" class="form-control" placeholder="00.00" onkeypress="return isNumberKey(evt,this)"/&gt;
  
  
  function isNumberKey(evt, element) {
   var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode &gt; 31 &amp;&amp; (charCode &lt; 48 || charCode &gt; 57) &amp;&amp; !(charCode == 46     || charcode == 8))
      return false;
    else {
     var len = $(element).val().length;
     var index = $(element).val().indexOf('.');
     if (index &gt; 0 &amp;&amp; charCode == 46) {
       return false;
     }
       if (index &gt; 0) {
      var CharAfterdot = (len + 1) - index;
       if (CharAfterdot &gt; 3) {
      return false;
    }
  }
  
    }
    return true;
   }
  </code></pre>
  
  <p>I dont want it to validate. I want it not accept other than integers and limit it to 2 digit after "."</p>