JavaScript Events

w3schools.com

An HTML event can be something the browser does or something the user does.

Here are some examples of HTML events:

  • an HTML page has finished loading

  • an HTML input field has changed

  • an HTML button was clicked

Often you want to do something when events happen

Here is the code for the previous example:

<button onclick="this.innerHTML=Date()">
  The time is?
</button>