Today I Learned

hashrocket A Hashrocket project

Examine all jQuery events for namespace

In a big system you can lose track of all the events that might be registered with jQuery. An easy way to see them all is:

$._data(window, 'events')

jQuery allows namespacing events as well. This can look like:

$(myElement).on('click.nsMyElement', function() { console.log('click'})

And check it out you can see that through data

$._data(myElement, 'events')['click'][0]['namespace']
> nsMyElement
See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.