HTMLOutputElement: checkValidity() method

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

{{APIRef("HTML DOM")}}

The **checkValidity()** method of the {{domxref("HTMLOutputElement")}} interface checks if the element is valid, but always returns true because {{HTMLElement("output")}} elements are never candidates for 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

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("HTMLOutputElement.reportValidity()")}}
  • {{HTMLElement("output")}}
  • {{HTMLElement("form")}}
  • Learn: Client-side form validation
  • Guide: Constraint validation