HTML EVENTLISTENER code example
Example 1: eventlistener javascript
document.querySelector("button").addEventListener("click", handle);
function handle() {
alert("I got clicked")
}
Example 2: event listener javascript
document.querySelector('div').addEventListener('click', () => {
console.log('div clicked');
});