Javascript examples for DOM:Event
Fire event with event.dispatchEvent
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/* w ww .j a v a 2 s . c o m*/ el = document.getElementById('x'); el.value = 'pancakes'; ev = document.createEvent('Event'); ev.initEvent('change', true, false); el.dispatchEvent(ev); }); </script> </head> <body> <input type="text" id="x" onchange="console.log('Changed!')"> </body> </html>