placeholder屬性作用
阿新 • • 發佈:2022-04-09
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>