HTMLSelectElement: checkValidity() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since December 2018.

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

Specification
HTML Standard
# dom-cva-checkvalidity-dev

Browser compatibility

BCD tables only load in the browser

See also