Manually firing .onchange() event for input field by calling onchange() method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Manually firing .onchange() event for input field by calling onchange() method

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.j a v a 2  s  . c  om*/
document.getElementById("range").value='500';
document.getElementById("range").onchange();
    });

      </script> 
   </head> 
   <body> 
      <input type="text" id="range" onchange="console.log(this.value)">  
   </body>
</html>

Related Tutorials