현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.
개요
In a Web form, the HTML <option>
element is used to create a control representing an item within a <select>
, an <optgroup>
or a <datalist>
HTML5 element.
- 콘텐츠 카테고리 None.
- 허용되는 콘텐츠 Text with eventually escaped characters (like
é
). - 태그 생략 The start tag is mandatory. The end tag is optional if this element is immediately followed by another
<option>
element or an<optgroup>
, or if the parent element has no more content. - 허용되는 부모 요소 A
<select>
, an<optgroup>
or a<datalist>
element. - DOM 인터페이스
HTMLOptionElement
속성
This element includes the global attributes.
disabled
- If this Boolean attribute is set, this option is not checkable. Often browsers grey out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. If this attribute is not set, the element can still be disabled if one its ancestors is a disabled
<optgroup>
element. label
- This attribute is text for the label indicating the meaning of the option. If the
label
attribute isn't defined, its value is that of the element text content.사용 참고: thelabel
attribute is designed to contain a short label typically used in a hierarchical menu. Thevalue
attribute describes a longer label designed to be used near a radio button, for example. selected
- If present, this Boolean attribute indicates that the option is initially selected. If the
<option>
element is the descendant of a<select>
element whosemultiple
attribute is not set, only one single<option>
of this<select>
element may have the selected attribute. value
- The content of this attribute represents the value to be submitted with the form, should this option be selected. If this attribute is omitted, the value is taken from the text content of the option element.
예제
See <select>
examples.
사양
사양 | 상태 | 주석 |
---|---|---|
WHATWG HTML Living Standard The definition of '<option>' in that specification. |
Living Standard | |
HTML5 The definition of '<option>' in that specification. |
Recommendation | |
HTML 4.01 Specification The definition of '<option>' in that specification. |
Recommendation |
브라우저 호환성
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1.0) [1] | (Yes) | (Yes) | (Yes) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | (Yes) | 1.0 (1.0) [1] | (Yes) | (Yes) | (Yes) |
Gecko 참고
[1] Prior to Gecko 7.0, (Firefox 7.0 / Thunderbird 7.0 / SeaMonkey 2.4), the label attribute incorrectly returned an empty string if not defined, instead of returning the element text content.
같이 보기
- Other form-related elements:
<form>
,<legend>
,<label>
,<button>
,<select>
,<datalist>
,<optgroup>
,<fieldset>
,<textarea>
,<keygen>
,<input>
,<output>
,<progress>
and<meter>
.