GoConqr has a new look! Let us know what you think.

Module 7 of 33 · Media

Invalid Event

Kostas Diakogiannis

Invalid Event

 The invalid event

The invalid event is a unique event to html DOM form input fields. It is triggered any time the checkValidity() functions returns a false boolean value (see a slide below). Inside this event we can specify and define a set of actions that are going to happen any time a field contains an invalid data. 

Thus we can use the setCustomValidity() function to create a custom useful error message to the user and avoid giving him the standard default message from browser (preventDefault() is necessary to avoid this before doing anything further).

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?