Class HTMLOptionElement

All Implemented Interfaces:
Serializable, 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:
  • Constructor Details

    • HTMLOptionElement

      public HTMLOptionElement()
  • Method Details

    • jsConstructor

      public void jsConstructor(Object newText, 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(Object newText, 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 String getValue()
      Returns the value of the value property.
      Overrides:
      getValue in class HTMLElement
      Returns:
      the value property
    • setValue

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

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

      public void setText(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 String getLabel()
      Returns the value of the label property.
      Returns:
      the label property
    • setLabel

      public void setLabel(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(String name, 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(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