html select元素,默认不在选项中

问题描述:

可能重复:
< select>占位符

Possible Duplicate:
<select> placeholder

我想做这样的事情:

<select>
    <option selected="selected">Choose option</option>
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
    <option>Option 4</option>
</select>

这是 jsfiddle.

现在,我希望选择的第一个选项的内容选择选项"在下拉菜单中不可见.如果可以使用select元素,或者我应该做自定义的事情,我该怎么做. 预先感谢.

now I want the first option the selected one with the content "Choose option" to not be visible in the dropdown. how can i do that, if that's possible with a select element or should i do a custom thing. Thanks in advance.

您可以在打开列表后立即删除所选元素:

You could remove the selected element as soon as you open the list:

$('select').click(function () {
  $('option[selected="selected"]', this).remove();
});

我不知道任何本机HTML/HTML5解决方案.

I am not aware of any native HTML/HTML5 solution.