HTMLSelectElement.setCustomValidity()

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.

HTMLSelectElement.setCustomValidity() 方法可為指定的元素設定自定義檢核訊息。使用空字串表示元素沒有發生違反自定檢核條件的錯誤。

語法

js
selectElt.setCustomValidity(string);

參數

  • stringDOMString,代表錯誤訊息。

規範

Specification
HTML Standard
# dom-cva-setcustomvalidity-dev

瀏覽器相容性

BCD tables only load in the browser

參見