Is there a way with jQuery to manually trigger an delegated event handler?
Take following example code:
We can pass an additional event configuration
to jQuery's $.Event()
as the second argument
. More information here.
$('#click-me').on('click', function(evt){
$(document).trigger($.Event('custom-click', {target: evt.currentTarget}));
});
$(document).on('custom-click', '#click-me', function(evt){
alert(`${evt.type} was triggered on button with ${evt.target.id} id.`);
})
Good Luck...