Javascript examples for DOM HTML Element:Input Text
Handle on key up event for input text box
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* www . jav a 2 s. c o m*/ document.getElementById('input-nickname').onkeyup = function(event) { this.value = this.value.replace(/[^a-z\d]/, ''); } } </script> </head> <body> <input type="text" id="input-nickname"> </body> </html>