Skip to content

Instantly share code, notes, and snippets.

@trevarj
Last active August 18, 2016 11:59
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 trevarj/b1f65d010306baf1f1ffd794e8b4948e to your computer and use it in GitHub Desktop.
Save trevarj/b1f65d010306baf1f1ffd794e8b4948e to your computer and use it in GitHub Desktop.
Synchronizes Select Dropdowns - jQuery
$(function(){
$('.testSubjectSelect').change(function() {
var selectedValues = $("option:selected").map(function(){return this.value;});
$('.testSubjectSelect').children('option').not(":contains('-Select a Subject-')").each(function() {
if ($.inArray($(this).val(), selectedValues) > -1 && !this.selected) {
$(this).attr('hidden', true);
} else {
$(this).removeAttr('hidden');
}
});
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment