HTML <input> minlength 屬性
定義和用法
minlength
属性規定 <input> 元素中所需的最小字符數。
注意:minlength
คุณสมบัตินี้สามารถใช้กับชนิด <input> ต่อไปนี้:
- text
- search
- url
- tel
- password
ตัวอย่าง
ตัวอย่าง <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>
ระบุภาษา
<input minlength="number">
ค่าของคุณสมบัติ
ค่า | คำอธิบาย |
---|---|
number | จำนวนอักษรของ <input> ที่จำเป็นในการใช้งาน |
การสนับสนุนโปรแกรมนี้
ตัวเลขในตารางนี้ระบุสูตรรุ่นแรกที่สนับสนุนคุณสมบัตินี้
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
40.0 | 17.0 | 51.0 | 10.1 | 27.0 |