Javascript examples for DOM HTML Element:Input Text
Set text box value to null
<html> <head></head> <body> <h1>Hello World</h1> <input type="text" value="hello" name="group"> <br> <input type="text" value="hello" name="group"> <br> <input type="text" value="hello" name="group"> <br> <br> <button onclick="myFunction()">Try it</button> <script> function myFunction() {//from www .j a v a 2 s. c om var x = document.getElementsByName("group"); var i; for (i = 0; i < x.length; i++) { x[i].setAttribute("value",""); } } </script> </body> </html>