0

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.

admin
  • 39
  • 8
  • 1
    What do you expect to receive? It only validates after you submit a form. – demkovych Jun 24 '20 at 15:25
  • Does this answer your question? [Detect the error message in the input field](https://stackoverflow.com/questions/62496266/detect-the-error-message-in-the-input-field) – Yousaf Jun 24 '20 at 15:26

1 Answers1

0

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

Chandresh
  • 140
  • 7