Want more coding tutorials like this do check our coding projects page there we have awesome coding projects done you can visit here – Visit coding projects.
- We want the entered number to be exactly 10 digits.
- The number should not contain any alphabets, only numbers.
- The field cannot be empty
- If any errors show on the screen
Add the HTML code
As you can see above there is a form and inside the form, there is an input and a button So first you need to add a form tag and give an id to the form.
Then inside the form add a number input the create an input tag and select the type to number like this and add an id to the input also. Add the required attribute to the input. The number input will only allow numbers to be entered.
Now you need to add an h5 tag to show any error messages and also give an id to it. Lastly, you need a button tag to make the button tag type=’submit’.
I hope I solved your problem from this tutorial:
- Mobile number validation in HTML
This was for today if you want coding guides in HINDI then you can visit our Hindi coding blog here –Hindi coding blog.
Thank you for reading, have a nice day 🙂