HTMLTextAreaElement: validity プロパティ

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.

validityHTMLTextAreaElement インターフェイスの読み取り専用プロパティで、この要素の有効状態を表す ValidityState オブジェクトを返します。

ValidityState オブジェクトです。

次の例では、テキストエリア要素の妥当性状態を取得し、妥当でない場合は処理します。

js
const textArea = document.getElementById("myTextArea");
const validityState = textArea.validity;
if (!validityState.valid) {
  // それぞれの妥当性状態を検査
}

仕様書

Specification
HTML
# the-constraint-validation-api:dom-cva-validity

ブラウザーの互換性

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
validity

Legend

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

Full support
Full support

関連情報