Difference between checkValidity & validity

Viewed 3425

I've noticed there are 2 ways for an input element validation:

  1. element.checkValidity().
  2. element.validity.valid.

I understand that validity is an object while checkValidity is a function but I don't understand when should I use either one of them and what is the key difference between them.

1 Answers
Related