I have created a series of custom jQuery events for use in mobile web applications. They work great and have been tested. However, I have run into a small problem which I am having trouble understanding.
I am using .clone()
on a few elements within the DOM, which contain a button. The button has some of the custom events bound to it (the events are bound using .on()
), but. Unfortunately, when I use jQuery's .clone()
, the bindings are not preserved, and I have to add them again.
Has anyone encountered this before, does someone know of a potential work around? I thought that using .on()
was supposed to preserve the binding for elements that exist now, or in the future?