Javascript examples for jQuery:Form Event
Check for empty space key input using javaScript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(window).load(function(){//from w w w . j a v a2 s . c om $("#nospace").keydown(function (e) { if (e.keyCode == 32 || e.keyCode==9) { e.preventDefault(); } }); }); </script> </head> <body> <input type="text" id="nospace"> </body> </html>