![]() |
The You can also set restrictions on what numbers are accepted. The following example displays a numeric input field, where you can enter a value from 1 to 5: |
Example:
HTML
<form>
<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>
<h2>Number Field</h2>
<p>The <strong>input type="number"</strong> defines a numeric input field.</p>
<p>You can use the min and max attributes to add numeric restrictions in the input field:</p>
<form action="/action_page.php">
<label for="quantity">Quantity (between 1 and 5):</label>
<input type="number" id="quantity" name="quantity" min="1" max="5">
<input type="submit" value="Submit">
</form>
</body>
</html>
How is to look HTML Input Type Number | HTML Input Types |
Full Code Example of HTML Input Type Number | HTML Input Types |
Read Full: | HTML Input Types |
Category: | Web Tutorial |
Sub Category: | HTML Input Types |
Uploaded: | 1 year ago |
Uploaded by: | Admin |
Views: | 88 |
Reffered: https://www.w3schools.com/html/html_form_input_types.asp