Skip to content

QuizNot attempted

Native validation

Which are part of the browser's built-in constraint validation?

Select all that apply.

1–4 to choose, Enter to submit
Show answer & explanation

Correct answers:

  • required, minlength, pattern, type="email"
  • The :invalid / :user-invalid CSS pseudo-classes for styling
  • form.checkValidity() and input.validity
  • Constraint validation is native: attributes like required, minlength, pattern, type="email"
  • CSS hooks :invalid and :user-invalid (only after interaction, so no red fields on load)
  • and the JS API checkValidity(), validity, setCustomValidity().
  • Not validate=true: no such attribute exists (the opposite, novalidate, does).
  • Always validate again on the server.