HtmlSelectElement Class
https://html.spec.whatwg.org/multipage/form-elements.html#htmlselectelement
public sealed class HtmlSelectElement : HtmlElement- Inheritance
HtmlElementHtmlSelectElement
Properties
| Name | Description |
|---|---|
| Autocomplete | Gets or sets the value of the autocomplete content attribute. |
| Disabled | Gets or sets a value indicating whether the element has the disabled content attribute. |
| Form | Gets the form owner of the element, or null when it has none. |
| Labels | Gets the label elements associated with the element. |
| Length | Gets or sets the number of options; setting it adds blank options or removes the last ones. |
| Multiple | Gets or sets a value indicating whether the element has the multiple content attribute. |
| Name | Gets or sets the value of the name content attribute. |
| Options | Gets the collection of the options of the select element. |
| Required | Gets or sets a value indicating whether the element has the required content attribute. |
| SelectedIndex | https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-selectedindex |
| SelectedOptions | Gets the collection of the options that are currently selected. |
| Size | Gets or sets the value of the size content attribute. |
| Type | https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-type |
| ValidationMessage | Gets the error message that would be shown to the user if the element is invalid, or an empty string. |
| Validity | Gets the ValidityState object that describes the validity of the element. |
| Value | https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-value |
| WillValidate | Gets a value indicating whether the element is a candidate for constraint validation. |
Autocomplete
HtmlElements.g.csGets or sets the value of the autocomplete content attribute.
public string Autocomplete { get; set; }Disabled
HtmlElements.g.csGets or sets a value indicating whether the element has the disabled content attribute.
public bool Disabled { get; set; }Property value
See also
Gets the form owner of the element, or null when it has none.
public HtmlFormElement? Form { get; }Labels
FormControlMembers.csGets the label elements associated with the element.
public NodeList Labels { get; }Length
SelectElements.csGets or sets the number of options; setting it adds blank options or removes the last ones.
public uint Length { get; set; }Property value
See also
Multiple
HtmlElements.g.csGets or sets a value indicating whether the element has the multiple content attribute.
public bool Multiple { get; set; }Property value
See also
Gets or sets the value of the name content attribute.
public string Name { get; set; }Property value
See also
Options
SelectElements.csGets the collection of the options of the select element.
public HtmlOptionsCollection Options { get; }Required
HtmlElements.g.csGets or sets a value indicating whether the element has the required content attribute.
public bool Required { get; set; }Property value
See also
SelectedIndex
SelectElements.cshttps://html.spec.whatwg.org/multipage/form-elements.html#dom-select-selectedindex
public int SelectedIndex { get; set; }Property value
See also
SelectedOptions
SelectElements.csGets the collection of the options that are currently selected.
public HtmlCollection SelectedOptions { get; }Gets or sets the value of the size content attribute.
public uint Size { get; set; }https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-type
public string Type { get; }Property value
See also
ValidationMessage
FormControlMembers.csGets the error message that would be shown to the user if the element is invalid, or an empty string.
public string ValidationMessage { get; }Validity
FormControlMembers.csGets the ValidityState object that describes the validity of the element.
public ValidityState Validity { get; }Value
SelectElements.cshttps://html.spec.whatwg.org/multipage/form-elements.html#dom-select-value
public string Value { get; set; }Property value
See also
WillValidate
FormControlMembers.csGets a value indicating whether the element is a candidate for constraint validation.
public bool WillValidate { get; }Indexers
| Name | Description |
|---|---|
| this[uint] | Gets or sets the option at the given index; setting null removes the option. |
this[uint]
SelectElements.csGets or sets the option at the given index; setting null removes the option.
public HtmlOptionElement? this[uint index] { get; set; }Methods
| Name | Description |
|---|---|
| Add(HtmlElement, HtmlElement?) | Inserts an option or optgroup element before the given element, or at the end when no element is given. |
| Add(HtmlElement, int) | Inserts an option or optgroup element before the option at the given index, or at the end when the index is invalid. |
| CheckValidity() | Returns whether the element satisfies its constraints, firing an invalid event when it does not. |
| Item(uint) | Returns the option at the given index, or null when the index is out of range. |
| NamedItem(string) | Returns the first option whose id or name matches the given name, or null when none matches. |
| Remove(int) | https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-remove |
| ReportValidity() | Checks whether the element satisfies its constraints, firing an invalid event when it does not. |
| SetCustomValidity(string) | Sets the custom validity error message of the element; an empty string clears the custom error. |
| ShowPicker() | https://html.spec.whatwg.org/multipage/input.html#dom-select-showpicker |
Add overloads
Add(HtmlElement, HtmlElement?)
SelectElements.csInserts an option or optgroup element before the given element, or at the end when no element is given.
public void Add(HtmlElement element, HtmlElement? before = null)Add(HtmlElement, int)
SelectElements.csInserts an option or optgroup element before the option at the given index, or at the end when the index is invalid.
public void Add(HtmlElement element, int before)CheckValidity()
FormControlMembers.csReturns whether the element satisfies its constraints, firing an invalid event when it does not.
public bool CheckValidity()Item(uint)
SelectElements.csReturns the option at the given index, or null when the index is out of range.
public HtmlOptionElement? Item(uint index)NamedItem(string)
SelectElements.csReturns the first option whose id or name matches the given name, or null when none matches.
public HtmlOptionElement? NamedItem(string name)Remove(int)
SelectElements.cshttps://html.spec.whatwg.org/multipage/form-elements.html#dom-select-remove
ReportValidity()
FormControlMembers.csChecks whether the element satisfies its constraints, firing an invalid event when it does not.
public bool ReportValidity()SetCustomValidity(string)
FormControlMembers.csSets the custom validity error message of the element; an empty string clears the custom error.
ShowPicker()
SelectElements.cshttps://html.spec.whatwg.org/multipage/input.html#dom-select-showpicker
public void ShowPicker()