Interface HTMLOptionsCollection

All Superinterfaces:
HTMLCollection
All Known Implementing Classes:
HTMLOptionsCollectionImpl

public interface HTMLOptionsCollection extends HTMLCollection
HTMLOptionsCollection is an interface representing a collection of HTML option elements (in document order) and offers methods and properties for traversing the list as well as optionally altering its items. This type is returned solely by the "options" property of select.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(Object element, Object before)
    Inserts element before the node given by before.
    void
    add.
    int
    Returns the number of elements in the collection.
    int
    Returns the index of the first selected item, if any, or −1 if there is no selected item.
    remove(int index)
    Removes the item with index index from the collection.
    boolean
    remove(Object element)
    Remove.
    void
    setLength(int length)
    setLength.
    void
    setSelectedIndex(int selectedIndex)
    setSelectedIndex.

    Methods inherited from interface org.loboevolution.html.dom.HTMLCollection

    item, namedItem, setItem
  • Method Details

    • getLength

      int getLength()
      Returns the number of elements in the collection.

      When set to a smaller number, truncates the number of option elements in the corresponding container.

      When set to a greater number, adds new blank option elements to that container.

      Specified by:
      getLength in interface HTMLCollection
      Returns:
      a Integer object.
    • setLength

      void setLength(int length)

      setLength.

      Parameters:
      length - a Integer object.
    • getSelectedIndex

      int getSelectedIndex()
      Returns the index of the first selected item, if any, or −1 if there is no selected item.

      Can be set, to change the selection.

      Returns:
      a Integer object.
    • setSelectedIndex

      void setSelectedIndex(int selectedIndex)

      setSelectedIndex.

      Parameters:
      selectedIndex - a Integer object.
    • add

      void add(Object element, Object before) throws DOMException
      Inserts element before the node given by before.

      The before argument can be a number, in which case element is inserted before the item with that number, or an element from the collection, in which case element is inserted before that element.

      If before is omitted, null, or a number out of range, then element will be added at the end of the list.

      This method will throw a "HierarchyRequestError" DOMException if element is an ancestor of the element into which it is to be inserted.

      Parameters:
      element - a Object object.
      before - a Object object.
      Throws:
      DOMException
    • add

      void add(HTMLOptionElement element)

      add.

      Parameters:
      element - a HTMLOptionElement object.
    • remove

      Node remove(int index)
      Removes the item with index index from the collection.
      Parameters:
      index - a Integer object.
      Returns:
      a Node object.
    • remove

      boolean remove(Object element)
      Remove.
      Parameters:
      element - the element
      Returns:
      a boolean.