ElementInternals: validationMessage property

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

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

{{APIRef("Web Components")}}

The **validationMessage** read-only property of the {{domxref("ElementInternals")}} interface returns the validation message for the element.

Value

A string containing the validation message of this element.

Examples

In the following example the validation message is set with {{domxref("ElementInternals.setValidity()")}}, and then returned with validationMessage.

js
this.internals_.setValidity({ valueMissing: true }, "my message");
console.log(this.internals_.validationMessage); // "my message"

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}