use Javascript to get the value of an element - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

use Javascript to get the value of an element

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/* w  w  w .java 2 s . c om*/
var initialPosition = document.getElementById('arrayPosition').innerHTML;
console.log(initialPosition);
    });

      </script> 
 </head> 
 <body> 
  <span id="arrayPosition">4</span>  
 </body>
</html>

Related Tutorials