HTMLSelectElement.setCustomValidity()

您正在阅读此内容的英文版本,因为该语系尚未翻译。 帮助我们翻译此文章吧!

HTMLSelectElement.setCustomValidity() 方法设置指定的验证消息为选择元素的自定义验证消息。

使用空字符串来表示该元素没有自定义的验证错误。

语法

selectElt.setCustomValidity(string);

Parameters

  • string 将作为错误信息包含到 DOMString 之中。

Specifications

Specification Status Comment
HTML Living Standard
HTMLSelectElement.setCustomValidity()
Living Standard No change since the latest snapshot, HTML5.
HTML5
HTMLSelectElement.setCustomValidity()
Recommendation Initial definition, snapshot of HTML Living Standard

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Edge Safari (WebKit)
Basic support (Yes) (Yes) 4.0 (2.0) (Yes) ? (Yes) ?
Feature Android Chrome Edge Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support ? ? (Yes) 4.0 (2.0) 1.0 ? ? ?

查看更多