Also, the ‘@’ must not be the first character of the email address, and the last dot must at least be one character after the ‘@’ sign.
If so, it allows it to be submitted to the server and (usually) saved in a database; if not, it gives you error messages to explain what you've done wrong (provided you've done it right).
Java Script provides a way to validate form's data on the client's computer before sending it to the web server. First let us see how to do a basic form validation.
In the above form, we are calling validate() to validate data when onsubmit event is occurring.
However, that doesn’t mean client side validation should be forgotten.
Therefore Java Script form validation libraries allow developers to customize forms, error messages and styling, as well as simplifying the creation of validation rules.