Javascript examples for jQuery:Number
JQuery number only validation
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-2.2.4.min.js"></script> <script type="text/javascript"> window.onload=function(){/*from w w w .ja v a2s.c om*/ $('.alphaOnly').bind('keypress', function(event){ var regex = new RegExp('\\d'); console.log(regex.test(event.key)); }); } </script> </head> <body> <input type="text" class="alphaOnly"> </body> </html>