placeholder 属性有什么作用?

2017-08-08  本文已影响0人  vs陈默

定义和用法

placeholder 属性提供可描述输入字段预期值的提示信息(hint)。
该提示会在输入字段为空时显示,并会在字段获得焦点时消失。
注释:placeholder 属性适用于以下的 <input> 类型:text, search, url, telephone, email 以及 password。

eg:

带有 placeholder 文本的搜索字段:

  <form action="demo_form.asp" method="get">
<input type="search" name="user_search" placeholder="Search W3School" />
<input type="submit" />

</form>1

上一篇 下一篇

猜你喜欢

热点阅读