Table of Contents

Class HTMLOptionsCollection

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The HTMLOptionsCollection interface represents a collection of <option> HTML elements (in document order) and offers methods and properties for selecting from the list as well as optionally altering its items. This object is returned only by the options property of select.

[Value("HTMLOptionsCollection")]
public class HTMLOptionsCollection : HTMLCollection
Inheritance
HTMLOptionsCollection
Inherited Members

Remarks

Constructors

HTMLOptionsCollection()

public HTMLOptionsCollection()

Properties

Length

The length property of the HTMLOptionsCollection interface returns the number of {{htmlelement("option")}} elements in the collection. The property can get or set the size of the collection.

[Value("length")]
public ulong Length { get; set; }

Property Value

ulong

An integer value representing the number of items in this HTMLOptionsCollection.

Remarks

When setting length to a value smaller than the current, the options collection gets truncated; otherwise, new blank <option> elements are appended to the end of the <select>.

-Add(Union54, Union55?)
-Remove(long)
-SelectedIndex
-HTMLSelectElement
-HTMLOptGroupElement
-Length

See also on MDN

SelectedIndex

The selectedIndex property of the HTMLOptionsCollection interface is the numeric index of the first selected {{HTMLElement("option")}} element, if any, or −1 if no <option> is selected. Setting this property selects the option at that index and deselects all other options in this collection, while setting it to -1 deselects any currently selected elements. It is exactly equivalent to the SelectedIndex property of the HTMLSelectElement that owns this collection.

[Value("selectedIndex")]
public long SelectedIndex { get; set; }

Property Value

long

A number.

Remarks

Methods

Add(Union54, Union55?)

The add() method of the HTMLOptionsCollection interface adds an HTMLOptionElement or HTMLOptGroupElement to this HTMLOptionsCollection.

[Value("add")]
public GlobalObject.Undefined Add(Union54 element, Union55? before = null)

Parameters

element Union54
before Union55?

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Remove(long)

The remove() method of the HTMLOptionsCollection interface removes the {{HTMLelement("option")}} element specified by the index from this collection.

[Value("remove")]
public GlobalObject.Undefined Remove(long index)

Parameters

index long

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks