Valid only digit in textbox in firefox - Javascript jQuery

Javascript examples for jQuery:Form Number Field

Description

Valid only digit in textbox in firefox

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.5.2.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from ww w  .java2s  . co  m*/
$('input.numericInput').keypress(function (e) {
    return /[0-9]/.test(String.fromCharCode(e.which));
});
    });

      </script> 
   </head> 
   <body> 
      <input class="numericInput">  
   </body>
</html>

Related Tutorials