HTML <form> คุณสมบัติเติมข้อความอัตโนมัติ
ตัวอย่าง
แบบฟอร์มที่มีการเติมข้อความอัตโนมัติเมื่อ:
<form action="/action_page.php" method="get" autocomplete="on">
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname"><br><br>
<label for="email">Email:</label>
<input type="text" id="email" name="email"><br><br>
<input
type="submit">
</form>
ความหมายและการใช้งาน
แอตทริบิวต์autocomplete
ระบุว่าแบบฟอร์มควรมีการเปิดหรือปิดการเติมข้อความอัตโนมัติ
เมื่อเปิดการเติมข้อความอัตโนมัติ เบราว์เซอร์จะเติมค่าโดยอัตโนมัติตามค่าที่ผู้ใช้เคยป้อนมาก่อน
เคล็ดลับ:เป็นไปได้ที่จะมีการเติมข้อความอัตโนมัติ "เปิด" สำหรับแบบฟอร์ม และ "ปิด" สำหรับฟิลด์ป้อนข้อมูลเฉพาะ หรือในทางกลับกัน
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนแอตทริบิวต์อย่างเต็มที่
Attribute | |||||
---|---|---|---|---|---|
autocomplete | Yes | Yes | 4.0 | 5.2 | 15.0 |
ไวยากรณ์
<form autocomplete="on|off">
ค่าแอตทริบิวต์
Value | Description |
---|---|
on | Default. The browser will automatically complete values based on values that the user has entered before |
off | The user must enter a value into each field for every use. The browser does not automatically complete entries |
❮ แท็ก HTML <form>