[jQuery] [validate] required that select input's option is anything other than default
I'm trying to throw the field is required option on a select when its
selected option is my default option of dashes/0. I might be going
about this the complete wrong way with the required (dependency-
callback). Help is appreciated. My HTML/JS may make more sense than
this quesiton
HTML:
<select name="threshold" id="threshold" class="required">
<option value="0"
selected="selected">—————</option>
<option value="65">65%</option>
<option value="70">70%</option>
<option value="75">75%</option>
<option value="80">80%</option>
<option value="85">85%</option>
<option value="90">90%</option>
<option value="95">95%</option>
<option value="100">100%</option>
</select>
JS:
$('#mount-form').validate({
rules: {
threshold {
// I don't want to allow the selected option be 0
required: function(element) {
return $('#threshold option:selected').val() == '0';
}
}
}
});