Question

I'm using Thickbox (lightbox) built-in in WordPress to display some controls for user, some of controls using javascript to open dialogs like Upload Media that is already works fine outside the Thickbox.

I know that the Thickbox creates a new div with a unique-ID [TB_window] so i made a stand-alone js file for all scripts in Thickbox only but it still not working, it may be because Thickbox takes all controls from hidden container div and put it inside popup but i cannot deal with this scenario.

Any ideas? Thanks!

Was it helpful?

Solution

Finally, I found the solution by replacing event handler!

Old Scenario (WRONG)

$('#TB_window').on('click', '.upload_media a.btn_media_upload', function (e) { //Code } );

New (Working)

$('body').on('click', '#TB_window .upload_media a.btn_media_upload', function (e) { // Code });
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top