JavaScript Events
JavaScript Events
HTML Events
An HTML event can be something the browser does, or something a user does.
HTML allows event handler attributes, with JavaScript code, to be added to HTML
elements.
In the example above, the JavaScript code changes the content of the element
with id="demo".
In the next example, the code changes the content of its own element (using
this.innerHTML):
Output:
Common HTML Events
Here is a list of some common HTML events:
Many different methods can be used to let JavaScript work with events: