Tell me more ×  The HTML5 spec defines some very interesting
validation components, including pattern (for validating against
a Regexp) and required (for marking a field as required). As
best I can tell, however, no browser yet actually does any
validation based on these attributes.  I found a comparison of
HTML5 support across engines, but there is no information about
validation there. In the browsers I've tried (Firefox 3.5.8 and
Safari 4.0.4), no object has a checkValidity() method, so I
can't run the validations even though I can define them.  Is
there any support for this feature out there so I can
experiment?  share|improve this question add comment  6 Answers
up vote 4 down vote accepted  I tested the following in Google
Chrome:  <!DOCTYPE html>       .valid { color: #0d0; }
.invalid { color: #d00; }     <div id="output"></div>
function check(input) {         var out =
document.getElementById('output');         if (input.validity) {
if (input.validity.valid === true) {