Here is how I would do it if I cannot use jQuery
document.body.onclick = handleClick; function handleClick(e) { //If "e" is undefined use the global "event" variable e = e || event; var target = e.srcElement || e.target; alert(target.className); }
And here is the jQuery solution
$(document.body).click(function(e) { alert($(this).attr("class")); });
source share