Skip to content

Instantly share code, notes, and snippets.

@tuanphpvn
Last active August 3, 2016 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuanphpvn/7c325a49c944010b5ac8 to your computer and use it in GitHub Desktop.
Save tuanphpvn/7c325a49c944010b5ac8 to your computer and use it in GitHub Desktop.
Select list country in Magento 1 by country code #Magento #Automatic #CountryCode
<script>
jQuery.each(jQuery("#general_country_allow option"), function(){
var $this = jQuery(this), val = $this.val();
var arr = ["GB", "FR", "IT", "DE", "NL", "ES", "SE", "DK", "BE", "AT", "IE", "PT", "PL"];
if(jQuery.inArray(val, arr) !== -1) {
$this.attr("selected", "selected");
}
else {
$this.attr("selected", null);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment