I'm trying to use the jQuery Validate plugin to validate a dropdown. It validates the rest of my form correctly. But it doesn't work on the dropdown.
Here is my jQuery:
$('#campaignForm').validate({
rules: {
campaign_name: {
required: true
},
html_url: {
required: {
depends: function(element) {
return $('#html_url').val() == 'none';
}
}
}
},
messages: {
campaign_name: 'Please enter a campaign name',
html_url: 'Please select a template'
}
});
Here is my HTML:
<select name="html_url" id="html_url">
<option value="none">Select One...</option>
...
</select>
What am I doing wrong? Are my variable names colliding somehow. The rule for campaign name works fine.