选择标记的占位符 [英] placeholder for select tag

查看:148
本文介绍了选择标记的占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在选择标签上拥有占位符?

Is it possible to have a placeholder on a select tag?

<select placeholder="select your beverage">

   <option>Tea</option>

   <option>coffee</option>

   <option>soda</option>

</select>

或可能是一个可能的工作?

or may be a possible work around?

推荐答案

编辑:这是/我在写它的时候工作,但正如Blexen指出的,它不在规范。

This did/does work at the time I wrote it, but as Blexen pointed out, it's not in the spec.

添加如下选项:

<option default>Select Your Beverage</option>

正确的方式:

<option selected="selected">Select Your Beverage</option>

这篇关于选择标记的占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆