Reputation: 2897
In my select elements, I want a default text such as "please select an option". Also I use the jQuery plugin Validation with my form so that the user cannot submit the form if he has not selected something in my select elements.
Problem is, if I have "please select an option" in my selects, the form will validate.
How to deal with this problem?
Upvotes: 2
Views: 10952
Reputation: 41
<select>
<option style="display:none">please select an option</option>
<option disabled="disabled">I am a line</option>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
Upvotes: 4
Reputation: 191749
<select>
<option value="">Please select an option</option>
<option>
content is only used when the value
is not empty.
Upvotes: 4