placeholder属性作用

placeholder属性作用

1.介绍
copy
该提示会在输入字段为空时显示,并会在字段获得焦点时消失。 注释:placeholder 属性适用于以下的 <input> 类型:text, search, url, telephone, email 以及 password。
  • 示图:

image

copy
<!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>
posted @   AlexEvans  阅读(544)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
🚀