W3cubDocs

/Web APIs

HTMLSelectElement: checkValidity() method

The HTMLSelectElement.checkValidity() method checks 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 then returns false.

Syntax

js

checkValidity()

Parameters

None.

Return value

Returns true if the value of the element has no validity problems; otherwise returns false.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
checkValidity 4 12 4 10 9 5 ≤37 18 4 10.1 4 1.0

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement/checkValidity