If I use JQuery to set a div tag as in:
$('#maindiv').html(some content...);
then if I bind events to objects that “maindiv” now has, if I reset the html to “maindiv” at a later time, will those events still be hanging around if I choose not to re bind those events? I mean if I bind those events again after resetting the html, will I be doing double work?
Hopefully that made sense. Thanks much for any insight.
David
Updating the element content will remove all events of the inner elements.
However, you can use event delegation to bind events once only (so-called delegated-events approach):