Skip to content

Instantly share code, notes, and snippets.

@davidino
Created August 17, 2011 13:16
Show Gist options
  • Select an option

  • Save davidino/1151507 to your computer and use it in GitHub Desktop.

Select an option

Save davidino/1151507 to your computer and use it in GitHub Desktop.
try.js
$(document).ready(function(){
$('select[name="country"]').change(changeProvince());
var changeProvince = function(){
var country = this.value;
console.log(country);
$('select[name="province"] option').hide();
$('select[name="province"] option[value^=' + country + ']').show();
//refresh select options
try{
MSDropDown.init();
}catch(e){
//forget
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment