Horje
How to create HTML Input Type Number

The <input type="number"> defines a numeric input field.

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:


How is to look HTML Input Type Number

index.html
Example: HTML
 <form>
  <label for="quantity">Quantity (between 1 and 5):</label>
  <input type="number" id="quantity" name="quantity" min="1" max="5">
</form> 

Full Code Example of HTML Input Type Number

The input type="number" defines a numeric input field. You can use the min and max attributes to add numeric restrictions in the input field:
index.html
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>

Output should be:

Full Code Example of HTML Input Type Number





Category:
Web Tutorial
Sub Category:
HTML Input Types
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference