HTMLSelectElement.checkValidity()

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.

HTMLSelectElement.checkValidity() 方法會檢查元素是否有任何的檢核、驗證條件,並且檢查是否滿足這些條件。如果元素沒有通過這些檢核,瀏覽器會於該元素上觸發一個可取消的 invalid 事件,並回傳 false

語法

js
var result = selectElt.checkValidity();

規範

Specification
HTML Standard
# dom-cva-checkvalidity-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
checkValidity

Legend

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

Full support
Full support

參見