diff --git a/assets/js/frontend/country-select.js b/assets/js/frontend/country-select.js index 12a48d3378c..2b00e3b00fc 100644 --- a/assets/js/frontend/country-select.js +++ b/assets/js/frontend/country-select.js @@ -68,6 +68,6 @@ jQuery(document).ready(function($) { $('body').trigger('country_to_state_changing', [country, $(this).closest('div')]); - }); + }).change(); }); diff --git a/assets/js/frontend/country-select.min.js b/assets/js/frontend/country-select.min.js index 0a9768fe36a..9c61052c3ed 100644 --- a/assets/js/frontend/country-select.min.js +++ b/assets/js/frontend/country-select.min.js @@ -1 +1 @@ -jQuery(document).ready(function(e){if(typeof wc_country_select_params=="undefined")return!1;var t=wc_country_select_params.countries.replace(/"/g,'"'),n=e.parseJSON(t);e("select.country_to_state, input.country_to_state").change(function(){var t=e(this).val(),r=e(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state"),i=r.parent(),s=r.attr("name"),o=r.attr("id"),u=r.val(),a=r.attr("placeholder");if(n[t])if(n[t].length==0){r.parent().hide().find(".chosen-container").remove();r.replaceWith('');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}else{var f="",l=n[t];for(var c in l)f=f+'";r.parent().show();if(r.is("input")){r.replaceWith('');r=e(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state")}r.html('"+f);r.val(u);e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}else if(r.is("select")){i.show().find(".chosen-container").remove();r.replaceWith('');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}else if(r.is(".hidden")){i.show().find(".chosen-container").remove();r.replaceWith('');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}e("body").trigger("country_to_state_changing",[t,e(this).closest("div")])})}); \ No newline at end of file +jQuery(document).ready(function(e){if(typeof wc_country_select_params=="undefined")return!1;var t=wc_country_select_params.countries.replace(/"/g,'"'),n=e.parseJSON(t);e("select.country_to_state, input.country_to_state").change(function(){var t=e(this).val(),r=e(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state"),i=r.parent(),s=r.attr("name"),o=r.attr("id"),u=r.val(),a=r.attr("placeholder");if(n[t])if(n[t].length==0){r.parent().hide().find(".chosen-container").remove();r.replaceWith('');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}else{var f="",l=n[t];for(var c in l)f=f+'";r.parent().show();if(r.is("input")){r.replaceWith('');r=e(this).closest("div").find("#billing_state, #shipping_state, #calc_shipping_state")}r.html('"+f);r.val(u);e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}else if(r.is("select")){i.show().find(".chosen-container").remove();r.replaceWith('');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}else if(r.is(".hidden")){i.show().find(".chosen-container").remove();r.replaceWith('');e("body").trigger("country_to_state_changed",[t,e(this).closest("div")])}e("body").trigger("country_to_state_changing",[t,e(this).closest("div")])}).change()}); \ No newline at end of file