<optgroup>
HTML <optgroup>
요소는 <select>
요소의 옵션을 묶을 수 있습니다.
시도해보기
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
콘텐츠 카테고리 | 없음. |
---|---|
가능한 콘텐츠 | 0개 이상의 <option> 요소. |
태그 생략 |
여는 태그는 필수입니다. 바로 뒤따르는 요소가 다른
<optgroup> 이거나, 자신이 부모의 마지막 자식이라면 닫는
태그를 생략할 수 있습니다.
|
가능한 부모 요소 | <select> 요소. |
가능한 ARIA 역할 | 없음 |
DOM 인터페이스 | HTMLOptGroupElement (en-US) |
참고: <optgroup>
요소는 중첩할 수 없습니다.
특성
예제
<select>
<optgroup label="Group 1">
<option>Option 1.1</option>
</optgroup>
<optgroup label="Group 2">
<option>Option 2.1</option>
<option>Option 2.2</option>
</optgroup>
<optgroup label="Group 3" disabled>
<option>Option 3.1</option>
<option>Option 3.2</option>
<option>Option 3.3</option>
</optgroup>
</select>
결과
명세
Specification |
---|
HTML Standard # the-optgroup-element |
브라우저 호환성
BCD tables only load in the browser