placeholder属性作用

2023-02-14,,

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属性作用的相关教程结束。

《placeholder属性作用.doc》

下载本文的Word格式文档,以方便收藏与打印。