I’m using a jQuery accordion and would like to save the existing click event for each accordion item, remove all the events, and add them back in when needed. I’m familar with attaching/detaching handlers using .on and .off, but how do I go about preserving the default handler for each of the accordion items without overriding it?
Share
jQuery stores events and their handlers in
data('events)` with each element. You can try something like this.oldHandlerswill be an object in this format.If you want to get the
clickhandler from oldHandlers you can say.