The input The Tip: Use the max and min attributes together to create a range of legal values. |
Example:
HTML
<form>
<label for="datemax">Enter a date before 1980-01-01:</label>
<input type="date" id="datemax" name="datemax" max="1979-12-31"><br><br>
<label for="datemin">Enter a date after 2000-01-01:</label>
<input type="date" id="datemin" name="datemin" min="2000-01-02"><br><br>
<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5">
</form>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The input min and max attributes</h1>
<p>The min and max attributes specify the minimum and maximum values for an input element.</p>
<form action="/action_page.php">
<label for="datemax">Enter a date before 1980-01-01:</label>
<input type="date" id="datemax" name="datemax" max="1979-12-31"><br><br>
<label for="datemin">Enter a date after 2000-01-01:</label>
<input type="date" id="datemin" name="datemin" min="2000-01-02"><br><br>
<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
Reffered: https://horje.com/learn/504/how-to-create-html-maxlength-attribute-in-input
How is to look HTML min and max Attributes | HTML Input Attributes |
Full Code Example of HTML min and max Attributes | HTML Input Attributes |
Read Full: | HTML Input Attributes |
Category: | Web Tutorial |
Sub Category: | HTML Input Attributes |
Uploaded: | 11 months ago |
Uploaded by: | Admin |
Views: | 29 |