jQuery thickbox : Close lightbox from the event of the iframe page content

Shyju picture Shyju · Jun 18, 2009 · Viewed 9.4k times · Source

I have implemented the jquery thick box in my page to show another page content in the light bix.I used the iFrame mode of thick box to do this.Now i have a asp.net link button in the page which is being show in the light box. I want to close the light box from client side when this link(in the inner page) is clicked .Which function i have to use ? Any advice ?

Answer

Pierre Gayvallet picture Pierre Gayvallet · Jun 18, 2009

The method used to close the thickbox is tb_remove()

To call it from an iframed content, you just have to call the method for the iframe parent.

So

parent.tb_remove()

Should do the trick.

Just add the event on your link ( embed seem the easier way )

<a href="#" onClick="javascript:window.parent.tb_remove()"> ... </a>