Javascript examples for DOM HTML Element:Form Event
Eliminate white space from input field
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*ww w. j a v a 2s. c om*/ document.getElementById('mail').addEventListener('keydown' ,function(e) { var k =e.keyCode k ==32 &&e.preventDefault() }) } </script> </head> <body> <input type="text" id="mail"> </body> </html>