Last Updated : Jan 1, 2023
Let us see the way which we are going to show with the help of the example given below.
- 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 user name with a button to submit.
- Now, another validation used on username 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 username length.
- One thing to note here is that we did not redirect the users to another page on successful submission.