I am trying to copy a div content from one place to another, for this I am using something like:
$('#newDiv').html($('#oldDiv').html());
The problem is that some child elements have events attached using the bind() jquery method. I would want to copy also those events to the new location.
Any idea about a way to do this “event copy”?
Description
You create dynamic content in the moment you copy the content.
You need jQuery
.live()ordelegate()method to bind events to dynamically created html.Choose
.live()ordelegate()depending on the version of jQuery you are using.Check out my sample and this jsFiddle Demonstration
Sample
More Information