Solution 1 :

If you are not trying to validate while typing, then it will automatically show error after you submit it.

Problem :

I’m trying to add an email input to my form in HTML5, but somehow it still allows me to write anything without @ and the other stuff that an email contains.

 <input class="form-control" type="email" id="email" name="email" required>

Also tried:

<input type="text" pattern="/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$/" class="form-control" id="email" name="email" required>

and still nothing happens if I write it incorrectly.


Comment posted by demkovych

What do you expect to receive? It only validates after you submit a form.

Comment posted by Detect the error message in the input field

Does this answer your question?

Comment posted by admin

It does not show any errors. It just simply send the email with the invalid email.