HTML <input> minlength 屬性
示例
一個<input>元素,最小長度為8個字元
<form action="/action_page.php">
<label for="password">密碼:</label>
<input type="password" id="password" name="password" minlength="8"><br><br>
<input type="submit" value="提交">
</form>
自己動手試一試 »
定義和用法
minlength
屬性指定輸入欄位所需的最小字元數。
注意:minlength
屬性可用於輸入型別:text、search、url、tel、email 和 password。
瀏覽器支援
表格中的數字表示完全支援該屬性的第一個瀏覽器版本。
Attribute | |||||
---|---|---|---|---|---|
minlength | 40.0 | 17.0 | 51.0 | 10.1 | 27.0 |
語法
<input minlength="number">
屬性值
值 | 描述 |
---|---|
數字 | <input> 元素所需的最小字元數 |
❮ HTML <input> 標籤