js detect page click code example Example: how to detect clicks with javascript element.addEventListener('click', function () { alert('Clicked!') });