ValidityState.badInput
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.
badInput
は ValidityState オブジェクトの読み取り専用のプロパティで、ブラウザーが変換できない入力をユーザーが行ったかどうかを示します。例えば、数値の入力欄に文字列がある場合です。
値
論理値です。
例
html
<input type="number" id="age" />
js
const input = document.getElementById("age");
if (input.validity.badInput) {
console.log("Bad input detected…");
} else {
console.log("Content of input OK.");
}
仕様書
Specification |
---|
HTML # dom-validitystate-badinput-dev |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
badInput |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.