Class HTMLOptionElement

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

    public class HTMLOptionElement
    extends HTMLElement
    The JavaScript object that represents an option.
    See Also:
    Serialized Form
    • Constructor Detail

      • HTMLOptionElement

        public HTMLOptionElement()
    • Method Detail

      • jsConstructor

        public void jsConstructor​(java.lang.Object newText,
                                  java.lang.String newValue,
                                  boolean defaultSelected,
                                  boolean selected)
        JavaScript constructor.
        Parameters:
        newText - the text
        newValue - the value
        defaultSelected - Whether the option is initially selected
        selected - the current selection state of the option
      • jsConstructorOption

        public void jsConstructorOption​(java.lang.Object newText,
                                        java.lang.String newValue,
                                        boolean defaultSelected,
                                        boolean selected)
        JavaScript constructor.
        Parameters:
        newText - the text
        newValue - the value
        defaultSelected - Whether the option is initially selected
        selected - the current selection state of the option
      • getValue

        public java.lang.String getValue()
        Returns the value of the value property.
        Overrides:
        getValue in class HTMLElement
        Returns:
        the value property
      • setValue

        public void setValue​(java.lang.String newValue)
        Sets the value of the value property.
        Parameters:
        newValue - the value property
      • getText

        public java.lang.String getText()
        Returns the value of the text property.
        Returns:
        the text property
      • setText

        public void setText​(java.lang.String newText)
        Sets the value of the text property.
        Parameters:
        newText - the text property
      • isSelected

        public boolean isSelected()
        Returns the value of the selected property.
        Returns:
        the text property
      • setSelected

        public void setSelected​(boolean selected)
        Sets the value of the selected property.
        Parameters:
        selected - the new selected property
      • isDefaultSelected

        public boolean isDefaultSelected()
        Returns the value of the defaultSelected property.
        Returns:
        the text property
      • getLabel

        public java.lang.String getLabel()
        Returns the value of the label property.
        Returns:
        the label property
      • setLabel

        public void setLabel​(java.lang.String label)
        Sets the value of the label property.
        Parameters:
        label - the new label property
      • isDisabled

        public boolean isDisabled()
        Returns true if this element is disabled. Overridden to modify browser configurations.
        Overrides:
        isDisabled in class HTMLElement
        Returns:
        true if this element is disabled
      • setDisabled

        public void setDisabled​(boolean disabled)
        Sets whether or not to disable this element. Overridden to modify browser configurations.
        Overrides:
        setDisabled in class HTMLElement
        Parameters:
        disabled - True if this is to be disabled
      • getIndex

        public int getIndex()
        Returns the index property.
        Returns:
        the index property
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.String value)
        Sets an attribute. See also the DOM reference
        Overrides:
        setAttribute in class HTMLElement
        Parameters:
        name - Name of the attribute to set
        value - Value to set the attribute to
      • removeAttribute

        public void removeAttribute​(java.lang.String name)
        Removes the specified attribute.
        Overrides:
        removeAttribute in class Element
        Parameters:
        name - the name of the attribute to remove
      • getForm

        public HTMLFormElement getForm()
        Returns the value of the JavaScript form attribute.
        Overrides:
        getForm in class HTMLElement
        Returns:
        the value of the JavaScript form attribute