Javascript examples for DOM HTML Element:Input Text
Prevent '0' to be the first char entered in a textbox
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function Prevent(value) {/*from w ww . jav a2s . com*/ var x = document.getElementById("testInput"); if (value == '0') { x.value = ''; } } </script> </head> <body> <input type="text" onKeyUp="Prevent(this.value)" id="testInput"> </body> </html>