JSFiddle - React, Tailwind, and code Playground

HTML

<div id="firstname" style="width:300px;height:300px; border:1px solid red">

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);

$(function() {
    $('#firstname').on("click", function(e) {
        alert('clicked');
    });
    
    alert($.eventReport('#firstname'));
});