سؤال

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!

هل كانت مفيدة؟

المحلول

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 });
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى wordpress.stackexchange
scroll top