customizer control deactivation using JavaScrip API
-
I have 2 customizer controls, the first is a radio type.
I enqueued my script using “customize_controls_enqueue_scripts” hook
I want the second control to appear/disappear based on the first control’s value.
my javascript is:wp.customize.bind("ready", function () { var customize = this; customize("setting_name", function (setting) { setting.bind('change',function (value) { if(value=='desired_value'){ wp.customize.control('second_control').activate() } else{ wp.customize.control('second_control').deactivate() } }); }); });
this works ! hoever couple of seconds letter the preview window refreshes and the second control just gets reactivated on its own.
in absence of Javascript APIs documentation, is there someone who can explain this behavior to me or how to fix the issue ? thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘customizer control deactivation using JavaScrip API’ is closed to new replies.