public interface OptionElement extends Element
DOM option elements elements share all of the properties and methods of other HTML elements described in the element section. They also have the specialized interface HTMLOptionElement (or HTML 4 HTMLOptionElement).
No methods are defined on this interface.
ALLOW_KEYBOARD_INPUT
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
Modifier and Type | Method and Description |
---|---|
FormElement |
getForm()
If the option is a descendent of a
<select>
element, then this property has the same value as the form property of the corresponding {{DomXref("HTMLSelectElement") object; otherwise, it is null. |
int |
getIndex()
The position of the option within the list of options it belongs to, in tree-order.
|
String |
getLabel()
Reflects the value of the
label
HTML attribute, which provides a label for the option. |
String |
getText()
Contains the text content of the element.
|
String |
getValue()
Reflects the value of the
value
HTML attribute, if it exists; otherwise reflects value of the textContent
IDL attribute. |
boolean |
isDefaultSelected()
Reflects the value of the
selected
HTML attribute. |
boolean |
isDisabled()
Reflects the value of the
disabled
HTML attribute, which indicates that the option is unavailable to be selected. |
boolean |
isSelected()
Indicates whether the option is selected.
|
void |
setDefaultSelected(boolean arg) |
void |
setDisabled(boolean arg) |
void |
setLabel(String arg) |
void |
setSelected(boolean arg) |
void |
setText(String arg) |
void |
setValue(String arg) |
blur, click, focus, getAccessKey, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getBoundingClientRect, getChildElementCount, getChildren, getClassList, getClassName, getClientHeight, getClientLeft, getClientRects, getClientTop, getClientWidth, getContentEditable, getDataset, getDir, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getId, getInnerHTML, getInnerText, getLang, getLastElementChild, getNextElementSibling, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getOnabort, getOnbeforecopy, getOnbeforecut, getOnbeforepaste, getOnblur, getOnchange, getOnclick, getOncontextmenu, getOncopy, getOncut, getOndblclick, getOndrag, getOndragend, getOndragenter, getOndragleave, getOndragover, getOndragstart, getOndrop, getOnerror, getOnfocus, getOninput, getOninvalid, getOnkeydown, getOnkeypress, getOnkeyup, getOnload, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnmousewheel, getOnpaste, getOnreset, getOnscroll, getOnsearch, getOnselect, getOnselectstart, getOnsubmit, getOntouchcancel, getOntouchend, getOntouchmove, getOntouchstart, getOnwebkitfullscreenchange, getOnwebkitfullscreenerror, getOuterHTML, getOuterText, getPreviousElementSibling, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getStyle, getTabIndex, getTagName, getTitle, getWebkitdropzone, getWebkitRegionOverflow, hasAttribute, hasAttributeNS, insertAdjacentElement, insertAdjacentHTML, insertAdjacentText, isContentEditable, isDraggable, isHidden, isSpellcheck, isTranslate, querySelector, querySelectorAll, removeAttribute, removeAttributeNode, removeAttributeNS, scrollByLines, scrollByPages, scrollIntoView, scrollIntoView, scrollIntoViewIfNeeded, scrollIntoViewIfNeeded, setAccessKey, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setClassName, setContentEditable, setDir, setDraggable, setHidden, setId, setInnerHTML, setInnerText, setLang, setOnabort, setOnbeforecopy, setOnbeforecut, setOnbeforepaste, setOnblur, setOnchange, setOnclick, setOncontextmenu, setOncopy, setOncut, setOndblclick, setOndrag, setOndragend, setOndragenter, setOndragleave, setOndragover, setOndragstart, setOndrop, setOnerror, setOnfocus, setOninput, setOninvalid, setOnkeydown, setOnkeypress, setOnkeyup, setOnload, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnmousewheel, setOnpaste, setOnreset, setOnscroll, setOnsearch, setOnselect, setOnselectstart, setOnsubmit, setOntouchcancel, setOntouchend, setOntouchmove, setOntouchstart, setOnwebkitfullscreenchange, setOnwebkitfullscreenerror, setOuterHTML, setOuterText, setScrollLeft, setScrollTop, setSpellcheck, setTabIndex, setTitle, setTranslate, setWebkitdropzone, webkitMatchesSelector, webkitRequestFullscreen, webkitRequestFullScreen
addEventListener, addEventListener, appendChild, cloneNode, compareDocumentPosition, contains, dispatchEvent, getAttributes, getBaseURI, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPreviousSibling, getTextContent, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, removeEventListener, removeEventListener, replaceChild, setNodeValue, setPrefix, setTextContent
boolean isDefaultSelected()
selected
HTML attribute. which indicates whether the option is selected by default.void setDefaultSelected(boolean arg)
boolean isDisabled()
disabled
HTML attribute, which indicates that the option is unavailable to be selected. An option can also be disabled if it is a child of an <optgroup>
element that is disabled.void setDisabled(boolean arg)
FormElement getForm()
<select>
element, then this property has the same value as the form
property of the corresponding {{DomXref("HTMLSelectElement") object; otherwise, it is null.int getIndex()
String getLabel()
label
HTML attribute, which provides a label for the option. If this attribute isn't specifically set, reading it returns the element's text content.void setLabel(String arg)
boolean isSelected()
void setSelected(boolean arg)
String getText()
void setText(String arg)
String getValue()
value
HTML attribute, if it exists; otherwise reflects value of the textContent
IDL attribute.void setValue(String arg)
Copyright © 2018. All rights reserved.