需要Chrome中的下拉菜单选择

时间:2014-10-15 17:48:34

标签: html google-chrome

在带有“已禁用”选项的下拉表单元素上使用“required”可在Firefox中使用,以防止用户提交表单而不从下拉列表中选择内容,但不在Chrome中。你能帮忙吗?

<select id="topic" class="form-control" required="required">
      <option disabled selected>select genre</option>
      <option>All genres (whatever works)</option>
      <option>boogers</option>
      <option>cheese</option>
      <option>dumplings</option>
</select>

2 个答案:

答案 0 :(得分:0)

这可能有用

<option selected="true" disabled="disabled">select genre</option>

src:How to show disable HTML select option in by default?

答案 1 :(得分:0)

要使其正常工作,只需将value=""添加到默认选项即可。这个答案提供了一些关于此事的HTML5文档。

Can I apply the required attribute to <select> fields in HTML5?