AndyJarrett

Capture all click events with jQuery

A friend was after capturing any click event on a page and then checking the tag it was on/over. The great thing with jQuery is that you can get to this information with little effort. Below is a snippet of code which will dump the tag (in UPPERCASE) to the console.log.

$(document).bind('click', function(e) { console.log( e.toElement.tagName; ) });

If you want to know what else you can tap in to then change line 2 to console.log(e) and have a good explor around.