Table Maker3schools TranslateImage CompressorFavicon Icon GeneratorCrop & Resize Image
Apu
Apu August 08, 2022 . #Attribute . #Html

Input type='number' in HTML

The input type="number" in HTML has a built-in validation to reject non-numerical values. It means whenever users try to enter a non-numerical value in it, it prevents them to enter.

example of input type number attribute
<label>Mobile Number:</label>
<input type="number" placeholder="Mobile Number">
Try it Yourself »
The default type of <input> type attribute is text. If we define no attribute to the <input> element, then by default it's input element of type text.

It has some attributes.

  1. min - it specifies the minimum value that is allowed to enter.
  2. max - it specifies the maximum value that is allowed to enter.
  3. step - it specifies the interval between valid values in a number-based input.
  4. value - the value attribute specifies the value of an input element.
  5. placeholder - it provides a brief hint to the users as to what kind of information is expected in the input field.
save
listen
AI Answer
Write Your Answer
loading
back
View All