WordPress.org

Support

Support » Alpha/Beta » [Resolved] Widget preview doesn't reload when form field values are changed via javascript

[Resolved] Widget preview doesn't reload when form field values are changed via javascript

  • I have a widget with a file selector that utilizes the wordpress media frame. When the user selects a file, the widget’s js sets the value of the text input via jQuery, but the preview isn’t being triggered to reload. I noticed the reload only gets triggered if I manually edit the text input.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Which theme/plugin/widget are you using?

    I’m not using a publicly available theme or plugin.

    I noticed the same problem is true of theme settings as well. If you try to modify a theme setting or widget setting by assigning the input value via javascript, the preview window doesn’t refresh.

    You can test this by running this code:

    $('.customize-control-title').click(function() {
    	$('#customize-control-blogname input').val('Test Title');
    });

    The above code will change the Site Title input in the theme settings when you click on the Site Title label. Notice that the preview frame doesn’t reload even though the Site Title value was changed.

    That’s an expected behavior.
    When you add a value to an input element you should always trigger a change event.

    Ok thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Widget preview doesn't reload when form field values are changed via javascript’ is closed to new replies.