Open Thickbox With Onclick


There might be certain times when you would want to open a thickbox with onclick instead of the regular a href. Say you want to make a whole td cell clickable. To do so follow the below steps.

1. Open thickbox.js

2. Find the line –
tb_init(‘a.thickbox, area.thickbox, input.thickbox’);//pass where to apply thickbox

3. Add td.thickbox. The line would look like –
tb_init(‘a.thickbox, area.thickbox, input.thickbox, td.thickbox’);//pass where to apply thickbox

4. Next look for the line –
var a = this.href || this.alt;

5. Add the abbr attribute which would contain the link to open. The line would look like –
var a = this.href || this.alt || this.abbr;

6. Now add thickbox to td like
td class=”thickbox” abbr=”openthis.html”

Enjoy 🙂

This entry was posted in Javascript, jQuery and tagged , . Bookmark the permalink.

2 Responses to Open Thickbox With Onclick

  1. prashant saxena says:


    I am Creating A thickbox in html but the web site no any code to help me

    • Sumit Surai says:

      Hi Prashant,

      I am sorry I could not understand your problem. If you want to know how to implement Thickbox you will get all the help at Thickbox site

      If there are any specific issue you could not find there, you can ask here mentioning the problem in details.

Leave a Reply

Your email address will not be published. Required fields are marked *