Horje

RANGE - Input Control Elements - HTML
Learn
HTML - Input Control Elements - Range
Specifying a range

Use min and max attributes to restrict the range of numbers a user can input into an input of type number or range

Marks: <input type="number" size="6" name="marks" min="0" max="100" />
Subject Feedback: <input type="range" size="2" name="feedback" min="1" max="5" />

Match a Pattern

For more control, use the pattern attribute to specify any regular expression that must be matched in order to pass validation. You can also specify a title, which is included in the validation message if the field doesn't pass.

<input pattern="\d*" title="Numbers only, please.">

Here's the message shown in Google Chrome version 51 when attempting to submit the form with an invalid value inside this field:

Please match the format requested. Numbers only, please. (opens new window)

Not all browsers display a message for invalid patterns, although there is full support among most used modern browsers.

Check the latest support on CanIUse (opens new window) and implement accordingly.

Accept File Type

For input fields of type file, it is possible to accept only certain types of files, such as videos, images, audios, specific file extensions, or certain media types (opens new window). For example:

<input type="file" accept="image/*" title="Only images are allowed">

Multiple values can be specified with a comma, e.g.:

<input type="file" accept="image/*,.rar,application/zip">

Note: Adding novalidate attribute to the form element or formnovalidate attribute to the submit button, prevents validation on form elements. For example:

<form>
    <input type="text" name="name" required>
    <input type="email" name="email" required>
    <input pattern="\d*" name="number" required>

    <input type="submit" value="Publish"> <!-- form will be validated -->
    <input type="submit" value="Save" formnovalidate> <!-- form will NOT be validated -->
</form>

The form has fields that are required for "publishing" the draft but aren’t required for "saving" the draft.

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