Student-friendly HTML, CSS, and JavaScript reference with examples
The click event fires when an element is clicked.
const button = document.querySelector('button');
button.addEventListener('click', function() {
console.log('Button clicked!');
});
Most commonly used event for making things interactive.