Horje
What are the HTML Input Restrictions

Here is a list of some common input restrictions:

Attribute Description
checked Specifies that an input field should be pre-selected when the page loads (for type="checkbox" or type="radio")
disabled Specifies that an input field should be disabled
max Specifies the maximum value for an input field
maxlength Specifies the maximum number of character for an input field
min Specifies the minimum value for an input field
pattern Specifies a regular expression to check the input value against
readonly Specifies that an input field is read only (cannot be changed)
required Specifies that an input field is required (must be filled out)
size Specifies the width (in characters) of an input field
step Specifies the legal number intervals for an input field
value Specifies the default value for an input field

You will learn more about input restrictions in the next chapter.

The following example displays a numeric input field, where you can enter a value from 0 to 100, in steps of 10. The default value is 30:


Example

Depending on browser support: Fixed steps will apply in the input field.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h2>Numeric Steps</h2>

<p>Depending on browser support: Fixed steps will apply in the input field.</p>

<form action="/action_page.php">
  <label for="quantity">Quantity:</label>
  <input type="number" id="quantity" name="quantity" min="0" max="100" step="10" value="30">
  <input type="submit" value="Submit">
</form>

</body>
</html>

Output should be:

Example





Related Articles
What is HTML Input Types HTML Input Types
How to create HTML Input Type Text HTML Input Types
How to create HTML Input Type Password HTML Input Types
How to create HTML Input Type Submit HTML Input Types
How to create HTML Input Type Reset HTML Input Types
How to create HTML Input Type Radio HTML Input Types
How to create HTML Input Type Checkbox HTML Input Types
How to create HTML Input Type Button HTML Input Types
How to set HTML Input Type Color HTML Input Types
How to create HTML Input Type Date HTML Input Types
How to create HTML Input Type Datetime-local HTML Input Types
How to create HTML Input Type Email HTML Input Types
How to create HTML Input Type Image HTML Input Types
How to create HTML Input Type File HTML Input Types
How to create HTML Input Type Hidden HTML Input Types
How to create HTML Input Type Month HTML Input Types
How to create HTML Input Type Number HTML Input Types
What are the HTML Input Restrictions HTML Input Types
How to create HTML Input Type Range HTML Input Types
How to create HTML Input Type Search HTML Input Types
How to create HTML Input Type Tel HTML Input Types
How to create HTML Input Type Time HTML Input Types
How to build HTML Input Type Url HTML Input Types
How to create HTML Input Type Week HTML Input Types
How to stop browser autocomplete in HTML text input? HTML Input Types

Single Articles
ExampleHTML Input Types

Read Full:
HTML Input Types
Category:
Web Tutorial
Sub Category:
HTML Input Types
Uploaded:
1 year ago
Uploaded by:
Admin
Views:
54


Reffered: https://www.w3schools.com/html/html_form_input_types.asp

Share on: