HTMLFieldSetElement: checkValidity() method
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{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.
توجه: 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
- {{domxref("HTMLFieldSetElement.reportValidity()")}}
- {{HTMLElement("fieldset")}}
- {{HTMLElement("form")}}
- Learn: Client-side form validation
- Guide: Constraint validation