HTML <button> รูปแบบแอตทริบิวต์
ตัวอย่าง
ปุ่มที่อยู่นอกแบบฟอร์ม (แต่ยังคงเป็นส่วนหนึ่งของแบบฟอร์ม):
<form action="/action_page.php" method="get" id="form1">
<label for="fname">First
name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname"
name="lname">
</form>
<button type="submit" form="form1"
value="Submit">Submit</button>
ความหมายและการใช้งาน
แอตทริบิวต์form
ระบุรูปแบบที่ปุ่มเป็นของ
ค่าของแอตทริบิวต์นี้ต้องเท่ากับid
แอตทริบิวต์ของ
<form>
องค์ประกอบในเอกสารเดียวกัน
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนแอตทริบิวต์อย่างเต็มที่
Attribute | |||||
---|---|---|---|---|---|
form | 10.0 | 16.0 | 4.0 | 5.1 | 9.5 |
ไวยากรณ์
<button form="form_id">
ค่าแอตทริบิวต์
Value | Description |
---|---|
form_id | Specifies the form element the <button> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document. |
❮ แท็ก HTML <button>