This solution depends on the attachment point. For ease of demonstration I used the '*' selector to get everything (not so good for most things)
Warning: this uses undocumented functionality
Related jQuery find events handlers registered with an object
IF you want to target specific selectors you can do that instead. i.e. 'body', your class selector etc.
Results of clicking the button here is:
checking...
type: object
{
"click": [
{
"type": "click",
"origType": "click",
"data": undefined,
"handler": function () {
// DO ACTION HERE
console.log("got click");
},
"guid": 2,
"selector": ".element-selector",
"needsContext": false,
"namespace": ""
}
]
}
type: object
{
"custom": [
{
"type": "custom",
"origType": "custom",
"data": undefined,
"handler": function () {
// DO ACTION HERE
console.log("got change");
},
"guid": 4,
"selector": undefined,
"needsContext": undefined,
"namespace": ""
}
]
}
type: object
{
"change": [
{
"type": "change",
"origType": "change",
"data": undefined,
"handler": function () {
// DO ACTION HERE
console.log("got change");
},
"guid": 6,
"selector": undefined,
"needsContext": undefined,
"namespace": ""
}
]
}
type: object
{
"click": [
{
"type": "click",
"origType": "click",
"data": undefined,
"handler": function checkme() {
console.log('checking...');
$('*').each(function(index, element) {
var evts = $._data(element, "events");
if (typeof evts === "object") {
console.log("type:", typeof evts);
console.log(evts);
}
});
},
"guid": 8,
"selector": undefined,
"needsContext": undefined,
"namespace": ""
}
]
}
$('body').on('click', '.element-selector', function() {
// DO ACTION HERE
console.log("got click");
});
$('.element-selector').on('custom', function() {
// DO ACTION HERE
console.log("got custom");
});
$('.input-element-selector').on('change', function() {
// DO ACTION HERE
console.log("got change");
});
function checkme() {
console.log('checking...');
$('*').each(function(index, element) {
var evts = $._data(element, "events");
if (typeof evts === "object") {
console.log("type:", typeof evts);
console.log(evts);
}
});
}
$('.trigger-weird').on('click', checkme);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="element-selector">howdy</div>
<input type="text" class="input-element-selector" />
<button class="trigger-weird">click me</button>