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 AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
setCustomValidityChrome Full support YesEdge Full support 12Firefox Full support 4IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

參見

文件標籤與貢獻者

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