HTML <input> form attribute

Definition and usage

form The attribute specifies the form to which the <input> element belongs.

Example

Input field located outside the HTML form (but still part of the form):

<form action="/action_page.php" id="form1">
  <label for="fname">ชื่อ:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <input type="submit" value="ส่ง">
</form>
<label for="lname">นามสกุล:</label>
<input type="text" id="lname" name="lname" form="form1">

ทดลองด้วยตัวเอง

ภาษา

<input form="form_id">

ค่าของคุณสมบัติ

ค่า คำอธิบาย
form_id

กำหนด element <input> ที่เป็นส่วนหนึ่งของ form element

ค่าของคุณสมบัตินี้ต้องเท่ากับค่าของประกาย id ของ element <form> ในเอกสารเดียวกัน

การสนับสนุนเบราเซอร์

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
สนับสนุน สนับสนุน สนับสนุน 5.1 10.6