e01.org

HTMLOutputElement: checkValidity() method

HTML DOM

HTML DOM

The **`checkValidity()`** method of the HTMLOutputElement interface checks if the element is valid, but always returns true because output elements are never candidates for [constraint validation](/docs/Web/HTML/Guides/Constraint_validation).

## Syntax

```js-nolint
checkValidity()
```

### Parameters

None.

### Return value

A boolean value, `true`.

## Examples

In the following example, calling `checkValidity()` returns `true`.

```js
const element = document.getElementById("myOutput");
console.log(element.checkValidity());
```

## Specifications

## Browser compatibility

## See also

- HTMLOutputElement.reportValidity()
- output
- form
- [Learn: Client-side form validation](/docs/Learn_web_development/Extensions/Forms/Form_validation)
- [Guide: Constraint validation](/docs/Web/HTML/Guides/Constraint_validation)

source: MDN Web Docs mirror · page

Cite this

"HTMLOutputElement: checkValidity() method". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/HTMLOutputElement/checkValidity

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·