views:

45

answers:

2

Hi,

I am using facebox popup in one of my pages. I am having a button in the popup dialog. When I click that button the facebox popup should close (the same way it closes when we press outside the popup). How to do that?

Also, I am doing some Ajax stuff when that button is being pressed so I cannot override the onClick event.

+2  A: 
$(function() {
  $('#button-id').click($.facebox.close);
});

as long as you aren't actually setting event handlers through onclick, adding handlers won't override existing ones.

Matt Briggs
Thanks, let me try this and will get back.
Bragboy
I dont know where to put this code. :(. Sorry, I am new to JQuery.. These $ look a bit alien to me.. Can you plz explain what is happenin here ?
Bragboy
a function inside $() basically runs as soon as the dom is fully loaded. so you could put that whole block inside a script tag in the header.
Matt Briggs
Hey thanks for your help, i got it working by putting jQuery(document).trigger('close.facebox')
Bragboy
A: 
<a href='javascript:void(0);' onclick='jQuery("#facebox_overlay").click();'>close</a>

here's an onclick version hack

Neo