HTML 사전

option

설명

In a web form, the HTML option element (<option>) is used to create a control representing an item within a <select>, an <optgroup> or a <datalist> HTML5 element.

<option>요소는 웹에서 사용하는 폼 중에 <select>나 <optgroup>이나 HTML5의 <datalist>요소 안에 있는 항목을 만들 때 사용한다.

Usage Context

Permitted content Text with eventually escaped characters (like &eacute;)
Tag omission The start tag is mandatory. The end tag is optional this element is immediately followed by another <option> element or an <optgroup>, or if the parent element has no more content.
Permitted parent elements <select>, an <optgroup> or a <datalist> (HTML5) element.
Normative document HTML5, section 4.10.12 (HTML4.01, section 17)

속성

이 엘리먼트는 전역속성을 지원한다.

disabled

If this Boolean attribute is set, this option is not checkable. Often browsers grey out such control and it won't received 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.

disabled

이 속성은 불리언 속성이며, 이 속성값이 특정되면, <option>요소는 선택할 수 없는 상태가 된다. (Javascript로 조절하는 경우에는 불리언 값이 사용되지만 HTML 엘리먼트에는 그냥 disabled='disabled'로 지정한다). 많은 브라우저에서 이 속성에 참값이 지정된 옵션은 회색으로 표시되며 선택등의 어떠한 이벤트도 사용될수 없다(선택할수 없다). 이 속성에 값이 지정되지 않았다해도 만약 <optgroup> 부모 엘리먼트의 이 속성이 참으로 설정이 되었다면 그 자식 옵션 아이템역시 선택이 불가능하여진다. 

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.

이 속성은 <option>의 의미를 가리키는 레이블에 들어가는 텍스트이다. label속성이 지정되지 않으면, <option>요소 안에 들어있는 내용이 label의 값이 된다.

Usage note :
the label attribute is designed to contain a short label typically used in a hierarchical menu. The value attribute describes a longer label designed to be used near a radio button, for example.

사용시 참고사항:
label속성은 위계가 있는 메뉴에서 사용하기 위한 짧은 라벨을 값으로 갖기 위해 설계되었다. value속성은 예를 들면 라디오 버튼 옆에 오는 긴 라벨에 들어가는 값을 담기 위한 것이다. 

selected

If present, this Boolean attribute indicates that the option is initially selected. If the <option> element is the descendant of a <select> element whose multiple attribute is not set, only one single <option> of this <select> element may have the selected attribute.
value
The textual content of this attribute represents the label explaining the option. If it is not defined, its default value is the text content of the element.

이 속성은 불리언 속성이다. selected속성을 표시하면, 해당 <option>은 기본이 선택된 상태가 된다. <option>요소가 <select>요소의 하위 요소인데, 그 <select>요소의 multiple attribute 속성이 지정되지 않았다면, 이 <select>요소 내의 <option>중에 하나만이 selected 속성을 가질 수 있다. 

Usage note :
the label attribute is designed to contain a short label typically used in a hierarchical menu. The value attribute describes a longer label designed to be used near a radio button, for example.

사용시 참고사항:
label 속성은 보통 위계가 있는 메뉴에서 사용하는 짧은 라벨용으로 만들어졌다. value속성은 보통 긴 라벨, 예를 들면 라디오버튼의 우측에 쓰는 라벨용으로 만들어졌다.

예제

See <select> examples.
<select>
  <option>생활코딩</option>
  <option selected>생활드로잉</option>
  <option>나는 자취생이다!</option>
  <option>사전편찬위원회</option>
</select>

DOM Interface

This element implements the HTMLOptionElement interface.

이 요소는 HTMLOptionElement 인터페이스를 구현하였다.

호환성

Desktop
기능 구글크롬 파이어폭스Gecko) 인터넷 익스플로러 Opera Safari
기본적인 지원          
Mobile
기능 안드로이드 파이어폭스 모바일(Gecko) 인터넷 익스플로러 모바일 오페라 모바일 사파리 모바일
기본적인 지원          

참고

댓글

댓글 본문
버전 관리
김나솔
현재 버전
선택 버전
graphittie 자세히 보기