Compare string (object value and variable)
New to jQuery, and have been struggling to work out how to compare a the value of a drop-down list to a variable.
The from allows user to pick from a list of schools (#dropDownSchool), they select one and then programmes (or courses) not offered at that school are removed from a second drop down (#dropDownProgramme)list.
The window.alert shows me the school the school code is being picked up okay, and if I replace school with actual string, e.g. as below - then it works fine - all items in the drop down with value's beginning with RACL are removed as desired.
$("#dropDownProgramme option[value^='RACL']").remove();
But I want the user to select what's removed from the first drop down.
Here's the whole function trying to use a variable instead of hard coded string.
$("#target").click(function() {
var school=$('#dropDownSchool').val();
window.alert(school);
$("#dropDownProgramme option[value^=school]").remove();
});;
I suspect I've misunderstood something fundamental here, just what?
Any help much appreciated.
Thanks,
Jason