HTML <input> แอตทริบิวต์ความยาวสูงสุด
ตัวอย่าง
<input> องค์ประกอบที่มีความยาวสูงสุด 10 ตัวอักษร:
<form
action="/action_page.php">
<label for="username">Username:</label>
<input type="text"
id="username" name="username" maxlength="10"><br><br>
<input
type="submit" value="Submit">
</form>
ความหมายและการใช้งาน
แอตทริบิวต์maxlength
ระบุจำนวนอักขระสูงสุดที่อนุญาตใน<input>
องค์ประกอบ
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนแอตทริบิวต์อย่างเต็มที่
Attribute | |||||
---|---|---|---|---|---|
maxlength | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
<input maxlength="number">
ค่าแอตทริบิวต์
Value | Description |
---|---|
number | The maximum number of characters allowed in the <input> element. Default value is 524288 |
❮ แท็ก HTML <input>