I want to validate my selectboxes and I tried different approaches.
I don't want allow user to use default value = "Please select".
Validation is working only on first time, but when I'm submitting the form validation is passing.
My HTML select:
<select id="website_category" name="website[category]" class="selectBox" style="display: none; "><option value="">--- please select ---</option>
<option value="Banking">Banking</option>
<option value="Computers">Computers</option>
< Coupons <
Here is my code:
jQuery.validator.addMethod("notEqual", function(value, element, param) {
return value != param;
}, "Please select something");
...
'website[category]': {
notEqual: "--- please select ---"
},
also tried
required:true
Here is what I get. When I choose default value gives me:
but when I submit validation is passing:
WHY it is happening like that ? Can someone suggest right solution ?