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> 태그