diff --git a/assets/js/admin/settings/conditionals.js b/assets/js/admin/settings/conditionals.js index 20a6aa4..2a65011 100644 --- a/assets/js/admin/settings/conditionals.js +++ b/assets/js/admin/settings/conditionals.js @@ -120,6 +120,8 @@ function sm_hide_show_elements( target_value, current_value, not, table_row ) { // If we should get options via Ajax. if ( is_ajax ) { + sm_reset_option_value( element, ! table_row.hasClass( 'hidden' ) ); + let data = { 'action': 'sm_settings_get_select_data', 'id': current_value, @@ -134,19 +136,7 @@ function sm_hide_show_elements( target_value, current_value, not, table_row ) { } ).always( function () { - // Reset element value. - switch ( element.prop( 'tagName' ) ) { - case 'SELECT': - element.find( 'option' ).each( - function () { - jQuery( this.remove() ); - } - ); - if ( ! table_row.hasClass( 'hidden' ) ) { - element.append( jQuery( '