Created
June 24, 2013 22:01
-
-
Save nclundsten/5854029 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filterProvinces(element, countryCode) { | |
$(element).val(0); | |
$(element).find('optgroup').remove(); | |
options = $(element).data('options'); | |
//need to get the maching option by countrycode (id) | |
//$(element).append(html); | |
} | |
$(document).ready(function(){ | |
province = $("select[name=province]"); | |
opts = $(province).find('optgroup'); //get the opts as a var | |
$(province).data('options', $(opts)); //store as data | |
$(province).find('optgroup').remove(); //remove the elements | |
$("select[name=country]").live('change', function() { | |
province = $(this).siblings("select[name=province]"); | |
val = $(this).val(); | |
filterProvinces(province, val) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment