package js.html
extends Element › DOMElement › Node › EventTarget
Available on js
The HTMLSelectElement interface represents a select HTML Element. These elements also share all of the properties and methods of other HTML elements via the HTMLElement interface.
Documentation HTMLSelectElement by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
autocomplete:Stringautofocus:BoolA Boolean reflecting the autofocus HTML attribute, which indicates whether the control should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified. 2.0
disabled:BoolA Boolean reflecting the disabled HTML attribute, which indicates whether the control is disabled. If it is disabled, it does not accept clicks.
read onlyform:FormElementAn HTMLFormElement referencing the form that this element is associated with. If the element is not associated with of a form element, then it returns null.
read onlylabels:NodeListA NodeList of label elements associated with the element.
length:IntAn unsigned long The number of option elements in this select element.
multiple:BoolA Boolean reflecting the multiple HTML attribute, which indicates whether multiple items can be selected.
name:StringA DOMString reflecting the name HTML attribute, containing the name of this control used by servers and DOM search functions.
read onlyoptions:HTMLOptionsCollectionAn HTMLOptionsCollection representing the set of option elements contained by this element.
required:BoolA Boolean reflecting the required HTML attribute, which indicates whether the user is required to select a value before submitting the form. 2.0
selectedIndex:IntA long reflecting the index of the first selected option element. The value -1 indicates no element is selected.
read onlyselectedOptions:HTMLCollectionAn HTMLCollection representing the set of option elements that are selected.
size:IntA long reflecting the size HTML attribute, which contains the number of visible items in the control. The default is 1, unless multiple is true, in which case it is 4.
read onlytype:StringA DOMString represeting the form control's type. When multiple is true, it returns "select-multiple"; otherwise, it returns "select-one".
read onlyvalidationMessage:StringA DOMString representing a localized message that describes the validation constraints that the control does not satisfy (if any). This attribute is the empty string if the control is not a candidate for constraint validation (willValidate is false), or it satisfies its constraints.
read onlyvalidity:ValidityStateA ValidityState reflecting the validity state that this control is in.
value:StringA DOMString reflecting the value of the form control (the first selected option). Returns the value attribute of the option element or if it is missing, the text attribute.
read onlywillValidate:BoolA Boolean that indicates whether the button is a candidate for constraint validation. It is false if any conditions bar it from constraint validation.
add(element:EitherType<OptionElement, OptGroupElement>, ?before:EitherType<Element, Int>):VoidAdds an element to the collection of option elements for this select element.
Throws:
null |
DOMError |
|---|
checkValidity():BoolChecks whether the element has any constraints and whether it satisfies them. If the element fails its constraints, the browser fires a cancelable invalid event at the element (and returns false).
item(index:Int):ElementGets an item from the options collection for this select element. You can also access an item by specifying the index in array-style brackets or parentheses, without calling this method explicitly.
namedItem(name:String):OptionElementGets the item in the options collection with the specified name. The name string can match either the id or the name attribute of an option node. You can also access an item by specifying the name in array-style brackets or parentheses, without calling this method explicitly.
remove():Voidremove(index:Int):VoidRemoves the element at the specified index from the options collection for this select element.
reportValidity():BoolsetCustomValidity(error:String):VoidSets the custom validity message for the selection element to the specified message. Use the empty string to indicate that the element does not have a custom validity error.
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/SelectElement.html