Last Updated : Jan 1, 2023
Let us see the way which we are going to show with the help of the example given below.
The below example will help to understand this concept easily.
- First, we here create a basic structure of HTML. For this, we use HTML, head, title, and body with a script tag. We hope you know about the basic structure of HTML and which HTML tag is used for which concept.
- Here, as we see that we create a validation form in which we create a field for the name with a button to submit.
- Now, another validation used on name is of minimum and maximum characters. From the above codes, we understand that our codes must lie between 3 to 25 characters. If this validation is not fulfilled then this will show an error that is of name length.
- One thing to note here is that we did not redirect the users to another page on successful submission