//there are two ways to check the validity. inputElement.checkValidity() //returns true or false inputElement.validity //returns the validity-state object. inputElement.validity.valid //returns true/false