Alex Rivera | Logout

jQuery validate select box

Asked 2010-12-06T07:58:52.673
20

I am using jQuery Validation Plugin for form validation and I am not able to validate list/select box

<select id="select">
 <option value="-1">Choose an option</option>
 <option value="1">One</option>
 <option value="2">Two</option>
 <option value="3">Three</option>
</select>

Now, I want to make sure that the user selects anything but "Choose an option" (which is the default one, and has value as -1). So that it won't validate if you choose the first option. How can this be done?

Edit
Report

1 Answer

19

Put <option value="">Choose an option</option> as blank rather than -1

using jquery validation

rules: {                      
                select: "required"
}
answered 2010-12-06T08:01:43.797

Your Answer