Get the value of input in a div - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Get the value of input in a div

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*w  w w.  jav a2s . c om*/
var getV = document.getElementById("my").getElementsByTagName('input')[0];
console.log(getV.value);
    }

      </script> 
   </head> 
   <body> 
      <div id="my"> 
         <input value="E" size="2" maxlength="2" type="text"> 
      </div>  
   </body>
</html>

Related Tutorials