1

I have a component in a vast codebase. Before I bind any events or do anything I want to fetch all the currently bound events for that components.

Does jquery provide a way to fetch all the currently bound events for a component?

Any help is appreciated.

Cheers

1 Answer 1

5

jQuery stores the bound events in the special data functions of jQuery.

Try this out:

var events = $('div').data('events');
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. I'll give that a shot. Does that mean that "all the events" of all the components can be fetched that way. Someone mentioned that while attaching events if I give a namespace they can be fetched, but I am not sure what that means.
This should contain every event bound on the element, might not contain live events but every normal event, namespaced or not, should be in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.