[jQuery] Closing a Custom Modal/Dialog Window

[jQuery] Closing a Custom Modal/Dialog Window


Hello,
I am having a head scratcher that maybe someone on this list can help
me with.
I have a 'more' link that opens a dialog window. Inside the dialog
window is a close link to close the dialog window. The close link does
not work.
Here is the code that opens the dialog window:
$('.more-link').click( function() {
    $('#more-events').remove();
    offset = $(this).parent().offset();
    $('body').append('<div id="more-events"> <div>');
    $('#more-events').load('ajax.php?v=more_events', { 'date': $
(this).attr('id') })
        .css({ 'top': offset.top, 'left': offset.left});
    return false;
});
This works fine.
The XHTML that is loaded into the #more-events div look like:
<div style="top: 272px; left: 851px;" id="more-events"><div
class="date">20</div>
<div class="bgred allday event"><span class="allday-right">&nbsp;</
span>Test Event</div>
<div class="bgred allday event"><span class="allday-right">&nbsp;</
span>Test Event 4</div>
<div class="red event">12a Test Event 6</div>
<div class="red event">12a Test Event 5</div>
<div class="red event">12a Test Event 3 </div>
<a href="#" class="close-more-events">close</a></div>
I would think that the following code would close the dialog window,
but it does not seem to get executed.
$('.close-more-events').click( function() {
    console.log('we get here');
    $('.more-events').remove();
    return false;
});
Thanks in advance for any help,
Martin