HTMLButtonElement: validationMessage プロパティ

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since December 2018.

validationMessageHTMLButtonElement インターフェイスの読み取り専用プロパティで、(もしあれば)この <button> コントロールが満たさない検証制約を記述したローカライズされたメッセージを表す文字列を返します。このコントロールが制約検証の対象ではない場合(<button>typebutton または reset である場合)、または制約を満たしている場合は空文字列となります。

もし、この <button> が制約検証の対象であり(typesubmit に設定されているか既定値、またはHTMLButtonElement.willValidatetrue)、制約が満たされていない場合(ValidityState.customError が null でない)、値は検証中にユーザーに表示されるエラーメッセージとなります。

文字列です。

仕様書

Specification
HTML
# dom-cva-validationmessage-dev

ブラウザーの互換性

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

関連情報