Easy Tutorial
❮ Event Screenx Event Onresize ❯

HTML DOM Input Number Object


Input Number Object

The Input Number object represents an HTML <input> element with type="number".

Note: Internet Explorer 9 and earlier versions do not support the <input> element with the type="number" attribute.

Accessing an Input Number Object

You can access an <input> element with type="number" using the getElementById() function:

Tip: You can also access the Input Number object through the form's elements collection.

Creating an Input Number Object

You can create an <input> element with type="number" using the document.createElement() method:

Input Number Object Properties

Property Description
autocomplete Sets or returns the autocomplete attribute value of the number field
autofocus Sets or returns whether the number field should automatically get focus when the page loads
defaultValue Sets or returns the default value of the number field
disabled Sets or returns whether the number field is enabled or disabled
form Returns a reference to the form that contains the number field
labels Returns a list of label elements for the number field
list Returns a reference to the datalist that contains the number field
max Sets or returns the max attribute value of the number field
min Sets or returns the min attribute value of the number field
name Sets or returns the name attribute value of the number field
placeholder Sets or returns the placeholder attribute value of the number field
readOnly Sets or returns whether the number field is read-only
required Sets or returns whether the number field is required in the form
step Sets or returns the step attribute value of the number field
type Returns the type of the form element for the number field
value Sets or returns the value attribute value of the number field

Standard Properties and Events

The Input Number object also supports the standard properties and events.


Related Articles

HTML Tutorial: HTML Forms

HTML Reference: HTML <input> Tag

HTML Reference: HTML <input> type Attribute

❮ Event Screenx Event Onresize ❯