DOM Methods

HTMLInputElement.checkValidity()

Checks applicable constraints and returns whether the control passes. An invalid control dispatches invalid. This method does not necessarily display a validation message; reportValidity is for user-facing reporting. Validate again on the server. Example result: false.

Formal Syntax & Structure

html syntaxhtml
element.checkValidity()

Return Value

boolean

Checks applicable constraints and returns whether the control passes.

Working Example

Example Snippethtml
<input id="demo" type="number" min="2" value="1"><p>  Result:  <output id="result"></output></p><script>  const e = document.getElementById('demo');  const result = value => { document.getElementById("result").textContent = String(value); };  result(e.checkValidity());</script>

Browser Compatibility

Minimum supported versions across modern rendering engines

Widely Available
Chrome
4
Yes
Edge
12
Yes
Firefox
4
Yes
Safari
5
Yes
Opera
≤12.1
Yes
Checked desktop BCD snapshot: HTMLInputElement.checkValidity method. Versions denote the recorded start of support (≤ means at least that early), not a guarantee of all behavior. Unresolved mirror and preview rows omitted.
HTML Living Standard
HTML Reference