JSFiddle - React, Tailwind, and code Playground
by manseuk
HTML
<input type="button" value="click me" id="something" /><br />
<br />
<input type="button" value="Alert Events" id="runreport" />
JavaScript
(function($) {
$.eventReport = function(selector, root) {
var s = [];
$(selector || '*', root).andSelf().each(function() {
var e = $.data(this, 'events');
if(!e) return;
s.push(this.tagName);
if(this.id) s.push('#', this.id);
if(this.className) s.push('.', this.className);
for(var p in e) s.push('\n', p);
s.push('\n\n');
});
return s.join('');
}
$.fn.eventReport = function(selector) {
return $.eventReport(selector, this);
}
})(jQuery);
$('#something').click(function() {
return false;
});
$('#something').hover(function() {
return false;
});
$('#runreport').click(function() {
alert($.eventReport('#something'));
});