Html events: Difference between revisions

From wikinotes
Line 10: Line 10:
</blockquote><!-- Documentation -->
</blockquote><!-- Documentation -->


= Registring Callbacks =
= Registering Callbacks =
<blockquote>
<blockquote>
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">

Revision as of 15:16, 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

Registering Callbacks

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