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

語法

selectElt.setCustomValidity(string);

參數

  • stringDOMString,代表錯誤訊息。

規範

規範 狀態 意見
HTML Living Standard
The definition of 'HTMLSelectElement.setCustomValidity()' in that specification.
Living Standard No change since the latest snapshot, HTML5.
HTML5
The definition of 'HTMLSelectElement.setCustomValidity()' in that specification.
Recommendation Initial definition, snapshot of HTML Living Standard

瀏覽器相容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support YesEdge Full support YesFirefox Full support 4IE Full support YesOpera ? Safari ? WebView Android ? Chrome Android ? Edge Mobile Full support YesFirefox Android Full support 4Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

參見

文件標籤與貢獻者

此頁面的貢獻者: iigmir, jackblackevo
最近更新: iigmir,