To invoke thickbox using javascript
Asked Answered
E

2

7

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";
}

Esparza answered 1/12, 2010 at 4:0 Comment(0)
E
19

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.

Esparza answered 1/12, 2010 at 4:19 Comment(1)
Excellent. Saved me so much time :)Unseal
C
4

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>
Cowhide answered 5/1, 2018 at 15:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.