Javascript examples for DOM HTML Element:Input Text
Set default value null to input text box
<html> <head> <script type="text/javascript"> function Hello()/* ww w .j a v a 2s . c o m*/ { var a=document.getElementById('nm').value; console.log(a); document.getElementById('nm').value=null; console.log(document.getElementById('nm').value); } </script> </head> <body> Name : <input type="text" name="nm" id="nm"> <input type="button" value="CLick" onclick="Hello()"> </body> </html>