HTML 5 browser popup on input with type = "email"

When you submit the form in a new browser version that supports HTML5 markup, and your form has input type="email"an invalid email address, the form will not be submitted, which is good. You will also receive a bubble warning saying"Please enter an email address"

A simple demo is here .

Good, that's good at some point. In the demo, you will see a popup hide my specific error. Is there a way to prevent a bubble from appearing? or can i override the bubble style?

+5
source share
1 answer

You can stop the built-in browser check using the attribute novalidate:

<form action="" novalidate></form>

JavaScript- :

var element = [selector that selects the input field];
element.setCustomValidity('This is not a valid e-mail');

, .

+10

All Articles