Follow up to my original post: I had a typo in the code that I posted here. In the code to close the window it should be: $('#more-events').remove(); instead of: $('.more-events').remove();
I found that I could get it to work if I loaded the code to close the dialog window INSIDE the dialog window. I just think there has to be a more elegant way to do this, I think I am just missing it somewhere. I have been reading the code to the thickbox plugin hoping I will pickup on the key, but haven't figured it out yet. Again, if anyone has any insight, thanks in advance for your help. -Martin On Oct 2, 1:45 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > 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"> </ > span>Test Event</div> > <div class="bgred allday event"><span class="allday-right"> </ > 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