Javascript examples for DOM HTML Element:Input Text
Get input text box value in JavaScript
<html> <head></head> <body> <div> <form align="center" method="post"> <input id="mainText" type="text" align="center" placeholder="Search"> <input type="submit" onclick="myFunction()"> </form> </div> <script> function myFunction(){/*from w w w . ja v a 2s. c om*/ $a= document.getElementById("mainText").value; console.log($a); } </script> </body> </html>