Hi,

I've got a question I was hoping someone could shed some light on for
me.

Suppose you have a div like so:

<div id="container">
    <input type="checkbox" name="check" value="1"> One <br/>
    <input type="checkbox" name="check" value="2"> Two <br/>
    <input type="checkbox" name="check" value="3"> Three <br/>
</div>

1) Suppose you have bound a 'click' event to every checkbox in the
above:

    $("#container input).click(function() {alert('hi');});

2) Then, you carte blance replace all the html in the div as the
result of an ajax request:

    $("#container").html(htmlReturnedFromServer);

What happens to the events registered in step 1?  Are they "leaked"?
Does JQuery know to unbind them before replacing the HTML?  Does it
even have to do that to avoid a memory leak?  Do I need to unbind them
myself before replacing the HTML?

Thanks for the insight,
Erik

Reply via email to