Reading inputs and printing variables - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Reading inputs and printing variables

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
    function myFunction()/*from   w  ww.  jav a 2  s  . c om*/
    {
      var x=document.getElementById("myEmail").value;
      console.log(x);
    }

      </script> 
   </head> 
   <body> 
      <form> 
         <p> Input your email </p> 
         <input name="myEmail" id="myEmail" type="text"> 
      </form> 
      <button type="button" onclick="myFunction()">Submit Email</button>  
   </body>
</html>

Related Tutorials