ValidityState.rangeOverflow

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.

rangeOverflowValidityState オブジェクトの読み取り専用プロパティで、 <input> の値がユーザーに変更された後、その要素の max 属性に設定された制約に適合しないことを示します。

フィールドが数値の性質を持つ場合、例えば date, month, week, time, datetime-local, number, range の何れかの型であり、 max が設定されており、値が max の値に設定された制約に適合しない場合、 rangeOverflow プロパティが true になります。

次のようになっていたとします。

html
<input type="number" min="20" max="40" step="2" />

value > 40 であれば、 rangeOverflow は true になります。 true の場合、その要素は CSS の :invalid および :out-of-range 擬似クラスに一致します。

仕様書

Specification
HTML Standard
# dom-validitystate-rangeoverflow

ブラウザーの互換性

BCD tables only load in the browser

関連情報