You can use jQuery.clone(true) what this does is return data for the element. A parameter that is set to true also allows you to copy all events.
So, if you clone an element into a variable, you can return the old click events by simply replacing your target element with its old clone (which has old events)
So it looks like this:
step 1: clone the target element using jQuery.clone(true) into a variable
step 2: remove all click events from the target using jQuery.off('click')
Step 3: bind your event to the target using jQuery.on('click' function etc...)
step 4: when you are done, replace the target element with your clone (which has old events)
Here is a JSFiddle for viewing pleasure
(Sorry for the simplicity of JSFiddle, I quickly made fun of it, and I have no example where I will use this.)
EDIT: I forgot to explain jQuery.clone(true)
Michael
source share