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.
io error: No such file or directory (os error 2) (/home/runner/work/yari/yari/mdn/translated-content/files/zh-tw/web/api/html_dom_api/index.md)
HTMLSelectElement.checkValidity()
方法會檢查元素是否有任何的檢核、驗證條件,並且檢查是否滿足這些條件。如果元素沒有通過這些檢核,瀏覽器會於該元素上觸發一個可取消的 invalid
事件,並回傳 false
。
語法
js
var result = selectElt.checkValidity();
規範
Specification |
---|
HTML Standard # dom-cva-checkvalidity-dev |
瀏覽器相容性
BCD tables only load in the browser