Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

HTMLSelectElement

A HTML Element. These elements also share all of the properties and methods of other HTML elements via the HTMLElement interface.

interface HTMLSelectElement extends HTMLElement {
autocomplete: string;
disabled: boolean;
readonly form: HTMLFormElement | null;
readonly labels: NodeListOf<HTMLLabelElement>;
length: number;
multiple: boolean;
name: string;
readonly options: HTMLOptionsCollection;
required: boolean;
selectedIndex: number;
readonly selectedOptions: HTMLCollectionOf<HTMLOptionElement>;
size: number;
readonly type: string;
readonly validationMessage: string;
readonly validity: ValidityState;
value: string;
readonly willValidate: boolean;
[[Symbol.iterator]](): IterableIterator<HTMLOptionElement>;
add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number | null): void;
addEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLSelectElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void;
checkValidity(): boolean;
item(index: number): HTMLOptionElement | null;
namedItem(name: string): HTMLOptionElement | null;
remove(): void;
remove(index: number): void;
removeEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLSelectElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void;
reportValidity(): boolean;
setCustomValidity(error: string): void;
}
var HTMLSelectElement: {
prototype: HTMLSelectElement;
}
;

§Extends

§Index Signatures

§Properties

§
autocomplete: string
[src]
§
disabled: boolean
[src]
§
readonly form: HTMLFormElement | null
[src]

Retrieves a reference to the form that the object is embedded in.

§
length: number
[src]

Sets or retrieves the number of objects in a collection.

§
multiple: boolean
[src]

Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list.

§
name: string
[src]

Sets or retrieves the name of the object.

§
readonly options: HTMLOptionsCollection
[src]

Returns an HTMLOptionsCollection of the list of options.

§
required: boolean
[src]

When present, marks an element that can't be submitted without a value.

§
selectedIndex: number
[src]

Sets or retrieves the index of the selected option in a select object.

§
readonly selectedOptions: HTMLCollectionOf<HTMLOptionElement>
[src]
§
size: number
[src]

Sets or retrieves the number of rows in the list box.

§
readonly type: string
[src]

Retrieves the type of select control based on the value of the MULTIPLE attribute.

§
readonly validationMessage: string
[src]

Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting.

§
readonly validity: ValidityState
[src]

Returns a ValidityState object that represents the validity states of an element.

§
value: string
[src]

Sets or retrieves the value which is returned to the server when the form control is submitted.

§
readonly willValidate: boolean
[src]

Returns whether an element will successfully validate based on forms validation rules and constraints.

§Methods

§
[[Symbol.iterator]](): IterableIterator<HTMLOptionElement>
[src]
§
add(element: HTMLOptionElement | HTMLOptGroupElement, before?: HTMLElement | number | null): void
[src]

Adds an element to the areas, controlRange, or options collection.

@param element

Variant of type Number that specifies the index position in the collection where the element is placed. If no value is given, the method places the element at the end of the collection.

@param before

Variant of type Object that specifies an element to insert before, or null to append the object to the collection.

§
addEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLSelectElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
[src]
§
checkValidity(): boolean
[src]

Returns whether a form will validate when it is submitted, without having to submit it.

§
item(index: number): HTMLOptionElement | null
[src]

Retrieves a select object or an object from an options collection.

@param name

Variant of type Number or String that specifies the object or collection to retrieve. If this parameter is an integer, it is the zero-based index of the object. If this parameter is a string, all objects with matching name or id properties are retrieved, and a collection is returned if more than one match is made.

@param index

Variant of type Number that specifies the zero-based index of the object to retrieve when a collection is returned.

§
namedItem(name: string): HTMLOptionElement | null
[src]

Retrieves a select object or an object from an options collection.

@param namedItem

A String that specifies the name or id property of the object to retrieve. A collection is returned if more than one match is made.

§
remove(): void
[src]

Removes an element from the collection.

@param index

Number that specifies the zero-based index of the element to remove from the collection.

§
remove(index: number): void
[src]
§
removeEventListener<K extends keyof HTMLElementEventMap>(
type: K,
listener: (this: HTMLSelectElement, ev: HTMLElementEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
[src]
§
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void
[src]
§
reportValidity(): boolean
[src]
§
setCustomValidity(error: string): void
[src]

Sets a custom error message that is displayed when a form is submitted.

@param error

Sets a custom error message that is displayed when a form is submitted.