Back to Content

HTMLFieldSetElement: checkValidity() method

files/en-us/web/api/htmlfieldsetelement/checkvalidity/index.md

latest1.2 KB
Original Source

{{APIRef("HTML DOM")}}

The checkValidity() method of the {{domxref("HTMLFieldSetElement")}} interface checks if the element is valid, but always returns true because {{HTMLElement("fieldset")}} elements are never candidates for constraint validation.

[!NOTE] The {{cssxref(":valid")}} and {{cssxref(":invalid")}} CSS pseudo-classes are applied to <fieldset> elements based on the validity of its descendant form controls, not the fieldset itself.

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("myFieldSet");
console.log(element.checkValidity());

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also