Extends HTMLElement.
Indicates if the input has any validation issues.
RichInputElement.checkValidity()boolean
Programatically set the focus to the input.
RichInputElement.focus(options)| Name | Type | Description |
|---|---|---|
options |
Object |
Performs a validation check and reports any resulting failure to the user. If this input has an associated form element, the form submission will be prevented until the element is in a valid state.
RichInputElement.reportValidity()boolean
Sets the current selection to the text content of the input.
RichInputElement.select()Sets a custom validity message for the input. When a validation check is performed by reportValidity, this message will be shown to the user. To stop showing the message call this method with an empty string.
RichInputElement.setCustomValidity(message)| Name | Type | Description |
|---|---|---|
message |
string |
Sets the start and end positions of the text selection in the element. Note: As per the HTML5 spec, this method will throw a InvalidStateError exception for inputs with a type of email.
RichInputElement.setRangeText(replacement, start, end, selectMode)| Name | Type | Description |
|---|---|---|
replacement |
string | The string to insert. |
start (Optional) |
number | The index of the first character to replace. Defaults to the current selectionStart value. |
end (Optional) |
number | The index of the character after the last character to replace. Defaults to the current selectionEnd value. |
selectMode (Optional) |
"select", "start", "end" or "preserve" |
selection state after the text has been replaced. |
Sets the start and end positions of the text selection in the element. Note: As per the HTML5 spec, this method will throw a InvalidStateError exception for inputs with a type of email.
RichInputElement.setSelectionRange(selectionStart, selectionEnd, selectionDirection)| Name | Type | Description |
|---|---|---|
selectionStart |
number | The index of the first selected character |
selectionEnd |
number | The index of the last selected character |
selectionDirection (Optional) |
"forward", "backward" or "none" |
direction the selection was made |
A "on", "off" or "\<token-list>". Indicates whether the input value can be automatically completed by the browser.
A boolean. Controls whether the user is able interact with the input, or not. A disabled input cannot receive focus or have it's value modifed by the user.
A HTMLFormElement. Returns the form assosicated with the element, or null if a form is not available.
A HTMLDataListElement or null. Returns a reference to the <datalist> element referred to by the list attribute, or null if the attribute is not present or the list it refers to is not accessible.
Note: A clone of the <datalist> element reference by this property will be appended to the Shadow DOM when the input receives focus. This is required because the element that captures user input is located in the Shadow DOM and cannot access elements in the Light DOM. The clone is destroyed once the element loses focus.
A number. Determines the maximum number of characters permissable in the value.
A string. A string containing a regular expression that the user's input must match. The regular expression must match the entire input value, rather than matching a substring.
A string. A text string that is displayed in the field as a prompt until the user puts focus on the field.
A boolean. Determines whether a user can modify the input value. An input marked as read-only can receive focus.
A boolean. Determines if the user must supply a value for this input for it to be considered valid. If the input is marked as required and a value is missing, the user will be prompted to set one when attempting to submit a form.
A "forward", "backward", "none" or null. Gets or sets direction the current text selection was made. Note: As per the HTML5 spec, this property will return null for inputs with a type of email.
A number or null. Gets or sets the index of the last character in the text selection or the caret position, if nothing is selected. Note: As per the HTML5 spec, this property will return null for inputs with a type of email.
A number or null. Gets or sets the index of the first character in the text selection or the caret position, if nothing is selected. Note: As per the HTML5 spec, this property will return null for inputs with a type of email.
A string. The regular expression pattern used to control styling of the input value. The pattern must match the entire input value, rather than matching a substring.
A "text", "tel", "email" or "url". Controls the type of value the input should contain. If omitted or set to invalid value, the default value of text will be implied.
A string. The current validation error message to show the user.
A ValidityState. Returns the current validity state of the input.
A string. The text content of the input.
A boolean. Indicates whether this input will participate in validation or not.