Do any browsers yet support HTML5's checkValidity() method?

后端 未结 6 1457
轮回少年
轮回少年 2020-12-08 09:00

The HTML5 spec defines some very interesting validation components, including pattern (for validating against a Regexp) and required (for marking a field as required

6条回答
  •  情书的邮戳
    2020-12-08 09:11

    checkValidity() is suppost to work on either the form as a whole or an individual input.


    "Additionally, the checkValidity() method can be executed on either an individual field or the form as a whole, and returns true or false. Executing the method will also programmatically fire the invalid event for all invalid fields, or, if executed on a single field, only for that element."

    taken from a List Apart - http://www.alistapart.com/articles/forward-thinking-form-validation/


    "form . checkValidity() Returns true if the form's controls are all valid; otherwise, returns false." http://www.w3.org/TR/2011/WD-html5-20110525/association-of-controls-and-forms.html#constraint-validation

    "valid = element . checkValidity() Returns true if the element's value has no validity problems; false otherwise. Fires an invalid event at the element in the latter case." http://www.w3.org/TR/2011/WD-html5-20110525/forms.html#client-side-form-validation


    W3C - working draft.

提交回复
热议问题