[jQuery] Val() and if statement? Possibly just wrong syntax
I'm quite new to jQuery but forms are proving difficult for me. I'm
trying to make a dynamic select box named 'educType' allow or disallow
two other form fields depending on the selection. I'm pretty sure it
is just the 'if' statement being incorrect syntax but I can't find
examples for it.
Here is the code I have got below.
$(document).ready(function() {
function changeEd(){
var edValues = $(this).val();
if (edValues == "university") {
$("#edcounty, #coluni").attr("disabled", this.value == 'no');
}
}
$("#educType").change(changeEd);
changeEd();
});
I made it following the val() docs and some help from a previous post
(the code there is now in use elsewhere so thanks!) but this isn't
working and I give up!