The HTMLSelectElement.setCustomValidity()
method sets 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.
Syntax
selectElt.setCustomValidity(string);
Parameters
string
is theDOMString
containing the error message.
Specifications
Specification | Status | Comment |
HTML Living StandardThe definition of 'HTMLSelectElement.setCustomValidity()' in that specification. | Living Standard | No change since the latest snapshot, HTML5. |
HTML5The definition of 'HTMLSelectElement.setCustomValidity()' in that specification. | Recommendation | Initial definition, snapshot of HTML Living Standard |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
setCustomValidity
|
Chrome
Full support Yes |
Edge
Full support 12 |
Firefox
Full support 4 |
IE
Full support Yes |
Opera
Full support Yes |
Safari
Full support Yes |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support 4 |
Opera Android
Full support Yes |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support Yes |
Legend
- Full support
- Full support
See also
HTMLSelectElement.setCustomValidity() by Mozilla Contributors is licensed under CC-BY-SA 2.5.