var element = document.getElementById("elem"); element.onclick = function(event) { console.log(event); }