I am using jQuery validation plugin, it works fine for all fields
but, when I use it for select
it doesn't work
HTML
<form>
<select id="name" name="name">
<option>Select</option>
<option value='select'>Select</option>
<option value='abc'>ABC</option>
<option value='xyz'>XYZ</option>
</select>
<input type='submit' value='Submit' />
</form>
SCRIPT
var f=$("form").validate({
rules: {
name:{
required:
function(element) {
st=($(element).val() == '') || ($(element).val() == 'select');
return st;
}
}
},
messages: {
name: {required: "Please select name"}
});
Also, I want to stop submition
after validation, no matter whether the form is valid
or not
.
Note I don't want to use $.validator.addMethod
.
I've already searched