HTML DOM Input Number object
Input Number object
The Input Number object represents an HTML-lt;input> element that uses type "number".
Note: Internet Explorer 9 and earlier versions of IE do not support the use of the type-"number" property for the element of the .lt;input>
Access the Input Number object
You can use the getElementById() function to access the elements that use the type"number" property:
Tip: You can also access the Input Number object through the form's collection of elements.
Create an Input Number object
You can use the document.createElement() method to create an element that uses the type-"number" property:
x.setAttribute("type", "number"); Give it a try
Input Number object properties
Property | Describe |
---|---|
autocomplete | Set or return the autocomplete property value of the number field |
autofocus | Set or return whether the number field automatically gets focus after the page is loaded |
defaultValue | Set or return the default value for the number field |
disabled | Set or return whether the number field is available |
form | Returns a form reference that uses the number field |
labels | Returns a list of label elements for the number field |
list | Returns a datalist reference that contains the number field |
max | Set or return the max property value of the number field |
min | Set or return the min property value of the number field |
name | Set or return the name property value of the number field |
placeholder | Set or return the placeholder property value for the number field |
readOnly | Set or return whether the number field is read-only |
required | Set or return whether the number field is required in the form |
step | Set or return the step property value of the number field |
type | Returns the type of form element in the number field |
value | Set or return the value property value of the number field |
Standard properties and events
Input Number objects also support standard properties and events.
Related articles
HTML tutorial: HTML forms
HTML Reference Manual: HTML slt;input.gt; Tags
HTML Reference Manual: HTML slt;input> type property