JavaScript Introduction | Events | Event Concepts

Event Type

An event type is a string that represents the kind of event that occurred, and it is also called an event name.
Events for handling commonly used keyboard, mouse, HTML DOM, and Window object interactions are widely provided.

The following example handles an event that occurs when a specific paragraph in an HTML document is clicked.

<p onclick="changeText(this)">Click this string!</p>
...
<script>
function changeText(element) {
    element.innerHTML = "The content of the string has changed!";
}
</script>

Event Specification

In the past, only basic and simple events such as onload, onclick, and onmouseover were used.
However, as web technologies developed, new events such as touch and gesture increased rapidly.
As a result, it became impossible to define the complete list of events with a single standard.

Specifications for this expanded set of events are currently divided and defined as follows.

  1. DOM Level 3 Events specification
  2. HTML5-related event specifications
  3. Event specifications for mobile devices