Run JS after widget settings are saved?


I’ve written a small widget that uses JS for setting up some tabs in the settings panel. Is there a way to re-trigger the tab JS when the widget is done saving?

Looking at the WP JS source it doesn’t look like it, as it simply blows away the existing HTML & re-renders the entire form. I could potentially overwrite & do something nutty there but that seems really drastic.


After some hacking based upon One Trick Pony’s idea, here’s what I ended up with.

    if(parseInt("<?php echo $this->number; ?>", 10)) {
        $("[id$='<?php echo $this->id; ?>'] .tabs").tabs();

Basically I just send down some JS w/ some Widgets values hardcoded in & do some checks & fun CSS3 selectors to find the right DOM nodes.

Tivac 8 months 2020-11-24T14:10:32-05:00 0 Answers 9 views 0

Leave an answer