如何创建< select>占位符 [英] How to create a <select> placeholder
本文介绍了如何创建< select>占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的选择元素中,我想要一个默认文本,例如请选择一个选项。此外,我使用jQuery插件验证与我的表单,以便用户无法提交如果他没有在我的选择元素中选择某些内容,则表单。
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.
如何处理这个问题?
推荐答案
<select>
<option value="">Please select an option</option>
< option>
仅使用内容当值
不为空时。
<option>
content is only used when the value
is not empty.
这篇关于如何创建< select>占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文