Html events: Difference between revisions

From wikinotes
Line 4: Line 4:
<blockquote>
<blockquote>
{| class="wikitable"
{| class="wikitable"
|-
| html5 events || https://www.w3.org/TR/2018/WD-html53-20181018/semantics-embedded-content.html#media-elements-event-summary
|-
|-
| w3schools: events || https://www.w3schools.com/jsref/dom_obj_event.asp
| w3schools: events || https://www.w3schools.com/jsref/dom_obj_event.asp

Revision as of 22:38, 30 August 2021

You can register javascript callbacks to be fired on HTML DOM events.

Documentation

html5 events https://www.w3.org/TR/2018/WD-html53-20181018/semantics-embedded-content.html#media-elements-event-summary
w3schools: events https://www.w3schools.com/jsref/dom_obj_event.asp

Registering Callbacks

document
  .getElementById('button')
  .addEventListener('click', () => { /* do something when clicked */ })