Click handler fired only once
<p>I have a set of links that I iterate over and add click handlers.  Each link when clicked, fires an ajax request which upon success creates a div containing response data, and appends it to the DOM.  The newly appended div (a floating div similar to a small lightbox) however, is removed when the user clicks close(on the div) or clicks anywhere else on the screen.  I have a simple script below to monitor this change, but the click handler fires only once and does not work until after a page refresh.  What am I doing incorrectly?</p>

<pre><code>var monitorChange = function () {
    //Check if div has been appended to the dom and if so continue to monitor it
    if ( $('div.justappended').length &gt; 0 ) 
    {
        setTimeout(monitorChange,100);
    } 
    else 
    {
        //div has been removed from the dom
        alert('div removed');
        //...do additional stuff here
    }
};

$( 'span.someElements' ).each( function () {
    var that = $(this);
    $(that).click( monitorChange );
});
</code></pre>
