Event management

A function is linked to an action with addEventListener

This method associates an event handler to any element of an HTML page, dynamically after its loading.
The syntax:

EventTarget.addEventListener(DOMString type, EventListener fun, boolean)


x.addEventListener('click', function, false)

x.addEventListener('click', function1, false);

x.addEventListener('click', function2, false);

<button onclick="document.getElementById('demo').innerHTML = Date()">The time is?</button>

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

<button onclick="displayDate()">The time is?</button>