Number Type: by Kirthickkumar AR 21CCU028 HTML
Number Type: by Kirthickkumar AR 21CCU028 HTML
By
Kirthickkumar AR
21CCU028
HTML
Input type
The <input type=“number”>
defines a field for entering a
number. Use the following
attributes to specify restrictions:
max – specifies the maximum
value allowed. Min – specifies the
minimum value allowed.
VALUE
A number representing the value of the
number entered into the input. You can
set a default value for the input by
including a number inside the value
attribute, like so:
USING NUMBER INPUTS
The number input type should only be used for
incremental numbers, especially when spinbutton
incrementing and decrementing are helpful to user
experience. The number input type is not
appropriate for values that happen to only consist of
numbers but aren’t strictly speaking a number, such
as postal codes in many countries or credit card
numbers. For non-numeric inputs, consider using a
different input type, such as <input type=“tel”> or
other <input> type with the inputmode attribute:
CONTROLLING STEP SIZE
By default, the up and down buttons provided for
you to step the number up and down will step the
value up and down by 1. You can change this by
providing a step attribute, which takes as its value a
number specifying the step amount. Our above
example contains a placeholder saying that the
value should be a multiple of 10, so it makes sense
to add a step value of 10.
PLACEHOLDER
BHThe placeholder attribute is a string that
provides a brief hint to the user as to what
kind of information is expected in the field. It
should be a word or short phrase that
demonstrates the expected type of data,
rather than an explanatory message. The
text must not include carriage returns or line
feeds.
Thankyou