Update text inside <P> via innerHTML - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Paragraph

Description

Update text inside <P> via innerHTML

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <p id="decrease">$399.99</p> 
      <button type="button" onclick="decrease();">Start Now!</button> 
      <script type="text/javascript">
var i=399.99;
function decrease()/*from   www .j av a  2 s . c om*/
{
    i-=0.25;
    document.getElementById('decrease').innerHTML= '$' + +i;
}

      </script>  
   </body>
</html>

Related Tutorials