Define a field for entering a number (You can also set restrictions on what numbers are accepted).
The <input type="number">
defines a field for entering a number.
Use the following attributes to specify restrictions:
Tip: Always add the <label>
tag for best accessibility practices!
<input type="number">
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>Display a Number Field</h1>
<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">
</form>
</body>
</html>
Type: | Html |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded by: | Admin |