Html events: Difference between revisions
From wikinotes
(Created page with "You can register javascript callbacks to be fired on HTML DOM events. = Documentation = <blockquote> {| class="wikitable" |- | w3schools: events || https://www.w3schools.com/...") |
No edit summary |
||
Line 9: | Line 9: | ||
|} | |} | ||
</blockquote><!-- Documentation --> | </blockquote><!-- Documentation --> | ||
= Registring Callbacks = | |||
<blockquote> | |||
<syntaxhighlight lang="javascript"> | |||
document.getElementById('button').addEventListener('click', () => { | |||
// do something when clicked | |||
} | |||
</syntaxhighlight> | |||
</blockquote><!-- Registring Callbacks --> |
Revision as of 15:04, 30 July 2021
You can register javascript callbacks to be fired on HTML DOM events.
Documentation
w3schools: events https://www.w3schools.com/jsref/dom_obj_event.asp
Registring Callbacks
document.getElementById('button').addEventListener('click', () => { // do something when clicked }