ElementInternals: validationMessage プロパティ

Baseline 2023
Newly available

Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

validationMessageElementInternals インターフェイスの読み取り専用プロパティで、この要素の検証メッセージを返します。

この要素の検証メッセージを含む文字列です。

次の例では、検証メッセージを ElementInternals.setValidity() で設定し、validationMessage で返しています。

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

仕様書

Specification
HTML
# dom-elementinternals-validationmessage

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
validationMessage

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support