HTML <input> แอตทริบิวต์ความยาวขั้นต่ำ
ตัวอย่าง
<input> องค์ประกอบที่มีความยาวขั้นต่ำ 8 ตัวอักษร:
<form
action="/action_page.php">
<label for="password">Password:</label>
<input type="password"
id="password" name="password" minlength="8"><br><br>
<input
type="submit" value="Submit">
</form>
ความหมายและการใช้งาน
แอตทริบิวต์minlength
ระบุจำนวนอักขระขั้นต่ำที่จำเป็นในช่องป้อนข้อมูล
หมายเหตุ: สามารถใช้ แอตทริบิวต์minlength
กับประเภทการป้อนข้อมูล: text, search, url, tel, email และ password
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนแอตทริบิวต์อย่างเต็มที่
Attribute | |||||
---|---|---|---|---|---|
minlength | 40.0 | 17.0 | 51.0 | 10.1 | 27.0 |
ไวยากรณ์
<input minlength="number">
ค่าแอตทริบิวต์
Value | Description |
---|---|
number | The minimum number of characters required in an <input> element |
❮ แท็ก HTML <input>