Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To invoke thickbox using javascript

How to invoke a thickbox using javascript function. I am using this code.

//javascript function
function click_fn()
{
 self.location="upload.php?keepThis=true&TB_iframe=1&width=1000&height=400&model=true";
}

like image 685
Mohan Ram Avatar asked Dec 01 '10 04:12

Mohan Ram


2 Answers

Calling Thickbox via JavaScript


var url = "http://www.blah.com/something?KeepThis=true&TB_iframe=true&width=300&height=200";
tb_show("My Caption", url);

Syntax: tb_show(caption, url, imageGroup)

Code allows to call thickbox from javascript.

like image 90
Mohan Ram Avatar answered Oct 16 '22 04:10

Mohan Ram


You can trigger tb_show with inline html as well:

tb_show("Modal title", "#TB_inline?inlineId=modal_container");

When using text be ensure to keep them in p tags. Checkbox label text have to be valid HTML (with label for) otherwise the label gets striped out.

<div id="modal_container" style="display:none;">
    <p>
        Example Text
    </p>     
    <input type="checkbox" name="checkbox_name" id="checkbox_name" value="value">
    <label for="checkbox_name">Example Label</label>
</div>
like image 34
roest Avatar answered Oct 16 '22 04:10

roest