<input>標籤輸入預設值
阿新 • • 發佈:2020-12-20
1.value屬性
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="text" name="text" value="請輸入">
</body>
</html>
顯示結果:
滑鼠點選:
輸入內容:
2.placeholder屬性
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Document</title>
</head>
<body>
<input type="search" name="search" placeholder="請輸入">
</body>
</html>
顯示結果:
滑鼠點選:
輸入內容: