
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Limit Input Field in HTML
The HTML <input> tag is used to get user input in HTML. To give a limit to the input field, use the min and max attributes, which is to specify a maximum and minimum value for an input field respectively.
The max and min attributes are used with number, range, date, datetime, datetime-local, month, time and week input types.
Example
You can try to run the following code to give a limit to the input field in HTML −
<!DOCTYPE html> <html> <head> <title>HTML input number</title> </head> <body> <form action = "" method = "get"> Mention any number between 1 to 10 <input type="number" name="num" min="1" max="10"><br> <input type="submit" value="Submit"> </form> </body> </html>
Advertisements