Change content on Onchange event, handle onchange event in Javascript - Javascript DOM Event

Javascript examples for DOM Event:onchange

Description

Change content on Onchange event, handle onchange event in Javascript

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <form name="forms1">
          Enter Price: /* ww  w. j av  a 2s.c o  m*/
         <input type="text" id="price1" onchange="fun()">
          Value is: 
         <span id="price"></span> 
      </form> 
      <script>
 function fun()
    {
        var x=document.getElementById("price1").value;
        document.getElementById('price').innerHTML=x*2;
    }

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

Related Tutorials