Output value from div - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Div

Description

Output value from 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(){//from w  w w  .ja  v  a  2  s  . c om
var x = document.getElementsByClassName("price-txt")[0].innerHTML;
document.getElementById("demo").innerHTML = parseInt(x);
    }

      </script> 
   </head> 
   <body> 
      <div class="price-txt">
         145 GAR
      </div> 
      <p id="demo"></p>  
   </body>
</html>

Related Tutorials