1.

How to handle events in HTML?

Answer»

HTML allows event TRIGGER actions in browsers using javascript or JQuery. There are a lot of events like ‘ONCLICK’, ‘ondrag’, ‘onchange’, etc.

<!DOCTYPE html><html> <body style="padding-top:50px"> <h3 id="event_demo">0</h3> <input type="BUTTON" onclick="myFunction()" value="Click Me" /> <input type="reset" onclick="reset()" value="Reset" /> </body> <script> function myFunction() { var value = document.getElementById("event_demo").innerHTML value = parseInt(value) + 1; document.getElementById("event_demo").innerHTML = value; } function reset() { document.getElementById("event_demo").innerHTML = 0; } </script></html>


Discussion

No Comment Found