placeholder属性作用

发布时间:2025-12-09 11:54:18 浏览次数:1

placeholder属性作用

1.介绍
该提示会在输入字段为空时显示,并会在字段获得焦点时消失。注释:placeholder 属性适用于以下的 <input> 类型:text, search, url, telephone, email 以及 password。
  • 示图:
<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <meta http-equiv="X-UA-Compatible" content="IE=edge">    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <title>Document</title></head><body>    <b>注意:password 里面使用:value属性:默认值会变成小黑点。</b>    <br>    <p>placeholder="请输入密码"效果如下:</p>    <p>password:<input type="password" placeholder="请输入密码" maxlength="18"></p>    <br>    <p>value="请输入密码"效果如下:</p>    <p>password:<input type="password" value="请输入密码" maxlength="18"></p></body></html>
placeholder
需要做网站?需要网络推广?欢迎咨询客户经理 13272073477