title: How to restrict user to allow only numeric and optionally two decimal number
body: <p>I need to restrict user input to allow only a integer or a two decimal number with a limit from <code>0</code> till <code>99999.99</code>.</p>
  
  <p>Tried with script but not succeed in all scenarios.
  also, required this should work with mobile OS also.</p>
  
  <pre><code>     $('#txtamount').keydown(function (event) {
  
                  if (event.which == 8 || event.which == 9 || event.which == 37 || event.which == 38 || event.which == 46) {
                      //event.preventDefault();
                      return true;
                  }
  
                  alert('final' + event.which);
                  if ((event.which != 46 || $(this).val().indexOf('.') != -1) &amp;&amp; (event.which &lt; 48 || event.which &gt; 57)) {
                      return false;
                      event.preventDefault();
                  }
  
                  var text = $(this).val();
  
                  if ((text.indexOf('.') != -1) &amp;&amp; (text.substring(text.indexOf('.')).length &gt; 2)) {
                      return false;
                      event.preventDefault();
                  }
              });
  </code></pre>
  
  <p>Tried with below stuff but, not working to restrict special chars.</p>
  
  <p><a href="http://jsfiddle.net/jquerydeveloper/LmHkD/" rel="nofollow">http://jsfiddle.net/jquerydeveloper/LmHkD/</a></p>