HTML <select> แอตทริบิวต์รูปแบบ
ตัวอย่าง
รายการดรอปดาวน์ที่อยู่นอกแบบฟอร์ม (แต่ยังคงเป็นส่วนหนึ่งของแบบฟอร์ม):
<form action="/action_page.php" id="carform">
<label for="fname">Firstname:</label>
<input type="text" id="fname"
name="fname">
<input type="submit">
</form>
<label for="cars">Choose a car:</label>
<select
name="cars" id="cars" form="carform">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
ความหมายและการใช้งาน
แอตทริบิวต์form
ระบุรูปแบบรายการแบบหล่นลงเป็นของ
ค่าของแอตทริบิวต์นี้ต้องเท่ากับid
แอตทริบิวต์ของ
<form>
องค์ประกอบในเอกสารเดียวกัน
รองรับเบราว์เซอร์
Attribute | |||||
---|---|---|---|---|---|
form | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
<select form="form_id">
ค่าแอตทริบิวต์
Value | Description |
---|---|
form_id | Specifies the form element the <select> element belongs to. The value of this attribute must be equal to the id attribute of a <form> element in the same document. |
❮ แท็ก HTML <select>