What are Events?
HTML element events can be handled in the HTML document, in Javascript or a hybrid of both. The best practice is to handle element events completely in Javascript.
Two primary event senders are the DOM provided window
object and the document
object's element
objects. These are considered the source of the event.
Event Message
Most events contain data about the event. In Javascript this is an object. The event object includes information on the event source object.
Event Listeners
Functions are used to take action when an event occurs. In this role the functions are called listeners or handlers. The function is invoked each time the event occurs.
For a function to listen for an event, they need to be registered with the sender of the event as a listener. This is generally done once.