The Input Button object represents an HTML <input> element with type="button".
You can access an <input> element with type="button" by using getElementById():
Tip: You can also access <input type="button"> by searching through the elements collection of a form.
You can create an <input> element with type="button" by using the document.createElement() method:
Property | Description |
---|---|
autofocus | Sets or returns whether an input button should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of an input button |
disabled | Sets or returns whether an input button is disabled, or not |
form | Returns a reference to the form that contains the input button |
name | Sets or returns the value of the name attribute of an input button |
type | Returns which type of form element the input button is |
value | Sets or returns the value of the value attribute of an input button |
The Input Checkbox object represents an HTML <input> element with type="checkbox".
You can access an <input> element with type="checkbox" by using getElementById():
Tip: You can also access <input type="checkbox"> by searching through the elements collection of a form.
You can create an <input> element with type="checkbox" by using the document.createElement() method:
Property | Description |
---|---|
autofocus | Sets or returns whether a checkbox should automatically get focus when the page loads |
checked | Sets or returns the checked state of a checkbox |
defaultChecked | Returns the default value of the checked attribute |
defaultValue | Sets or returns the default value of a checkbox |
disabled | Sets or returns whether a checkbox is disabled, or not |
form | Returns a reference to the form that contains the checkbox |
indeterminate | Sets or returns the indeterminate state of the checkbox |
name | Sets or returns the value of the name attribute of a checkbox |
required | Sets or returns whether the checkbox must be checked before submitting a form |
type | Returns which type of form element the checkbox is |
value | Sets or returns the value of the value attribute of a checkbox |
The Input Color Object is new in HTML5.
The Input Color object represents an HTML <input> element with type="color".
Note: <input> elements with type="color" are not supported in Internet Explorer 11 and earlier versions or Safari 9.1 and earlier versions.
You can access an <input> element with type="color" by using getElementById():
Tip: You can also access <input type="color"> by searching through the elements collection of a form.
You can create an <input> element with type="color" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a color picker |
autofocus | Sets or returns whether a color picker should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a color picker |
disabled | Sets or returns whether a color picker is disabled, or not |
form | Returns a reference to the form that contains the color picker |
list | Returns a reference to the <datalist> element that contains the color picker |
name | Sets or returns the value of the name attribute of a color picker |
type | Returns which type of form element the color picker is |
value | Sets or returns the value of the value attribute of a color picker |
The Input Date Object is new in HTML5.
The Input Date object represents an HTML <input> element with type="date".
Note: <input> elements with type="date" do not show as any date field/calendar in IE11 and earlier versions.
You can access an <input> element with type="date" by using getElementById():
Tip: You can also access <input type="date"> by searching through the elements collection of a form.
You can create an <input> element with type="date" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a date field |
autofocus | Sets or returns whether a date field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a date field |
disabled | Sets or returns whether a date field is disabled, or not |
form | Returns a reference to the form that contains the date field |
list | Returns a reference to the datalist that contains the date field |
max | Sets or returns the value of the max attribute of the date field |
min | Sets or returns the value of the min attribute of the date field |
name | Sets or returns the value of the name attribute of a date field |
readOnly | Sets or returns whether the date field is read-only, or not |
required | Sets or returns whether the date field must be filled out before submitting a form |
step | Sets or returns the value of the step attribute of the date field |
type | Returns which type of form element the date field is |
value | Sets or returns the value of the value attribute of a date field |
Method | Description |
---|---|
stepDown() | Decrements the value of the date field by a specified number |
stepUp() | Increments the value of the date field by a specified number |
The Input Datetime Object is new in HTML5.
The Input Datetime object represents an HTML <input> element with type="datetime".
Note: <input> elements with type="datetime" do not show as any datetime field/calendar in any of the major browsers, except Safari.
You can access an <input> element with type="datetime" by using getElementById():
Tip: You can also access <input type="datetime"> by searching through the elements collection of a form.
You can create an <input> element with type="datetime" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a datetime field |
autofocus | Sets or returns whether a datetime field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a datetime field |
disabled | Sets or returns whether a datetime field is disabled, or not |
form | Returns a reference to the form that contains the datetime field |
list | Returns a reference to the datalist that contains the datetime field |
max | Sets or returns the value of the max attribute of the datetime field |
min | Sets or returns the value of the min attribute of the datetime field |
name | Sets or returns the value of the name attribute of a datetime field |
readOnly | Sets or returns whether the datetime field is read-only, or not |
required | Sets or returns whether the datetime field must be filled out before submitting a form |
step | Sets or returns the value of the step attribute of the datetime field |
type | Returns which type of form element the datetime field is |
value | Sets or returns the value of the value attribute of a datetime field |
Method | Description |
---|---|
stepDown() | Decrements the value of the datetime field by a specified number |
stepUp() | Increments the value of the datetime field by a specified number |
The Input DatetimeLocal Object is new in HTML5.
The Input DatetimeLocal object represents an HTML <input> element with type="datetime-local".
Note: <input> elements with type="datetime-local" do not show as any datetime field/calendar in Firefox or in IE12 and earlier versions.
You can access an <input> element with type="datetime-local" by using getElementById():
Tip: You can also access <input type="datetime-local"> by searching through the elements collection of a form.
You can create an <input> element with type="datetime-local" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a local datetime field |
autofocus | Sets or returns whether a local datetime field should automatically get focus upon page load |
defaultValue | Sets or returns the default value of a local datetime field |
disabled | Sets or returns whether a local datetime field is disabled, or not |
form | Returns a reference to the form that contains the local datetime field |
list | Returns a reference to the datalist that contains the local datetime field |
max | Sets or returns the value of the max attribute of the local datetime field |
min | Sets or returns the value of the min attribute of the local datetime field |
name | Sets or returns the value of the name attribute of a local datetime field |
readOnly | Sets or returns whether the local datetime field is read-only, or not |
required | Sets or returns whether the local datetime field must be filled out before submitting a form |
step | Sets or returns the value of the step attribute of the local datetime field |
type | Returns which type of form element the local datetime field is |
value | Sets or returns the value of the value attribute of a local datetime field |
Method | Description |
---|---|
stepDown() | Decrements the value of the datetime field by a specified number |
stepUp() | Increments the value of the datetime field by a specified number |
The Input Email Object is new in HTML5.
The Input Email object represents an HTML <input> element with type="email".
Note: <input> elements with type="email" are not supported in Internet Explorer 9 (and earlier versions), or Safari.
You can access an <input> element with type="email" by using getElementById():
Tip: You can also access <input type="email"> by searching through the elements collection of a form.
You can create an <input> element with type="email" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of an email field |
autofocus | Sets or returns whether an email field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of an email field |
disabled | Sets or returns whether an email field is disabled, or not |
form | Returns a reference to the form that contains the email field |
list | Returns a reference to the datalist that contains the email field |
maxLength | Sets or returns the value of the maxlength attribute of an email field |
multiple | Sets or returns whether a user is allowed to enter more than one email address in the email field |
name | Sets or returns the value of the name attribute of an email field |
pattern | Sets or returns the value of the pattern attribute of an email field |
placeholder | Sets or returns the value of the placeholder attribute of an email field |
readOnly | Sets or returns whether the email field is read-only, or not |
required | Sets or returns whether the email field must be filled out before submitting a form |
size | Sets or returns the value of the size attribute of the email field |
type | Returns which type of form element the email field is |
value | Sets or returns the value of the value attribute of an email field |
The Input FileUpload object represents an HTML <input> element with type="file".
You can access an <input> element with type="file" by using getElementById():
Tip: You can also access <input type="file"> by searching through the elements collection of a form.
You can create an <input> element with type="file" by using the document.createElement() method:
Property | Description |
---|---|
accept | Sets or returns the value of the accept attribute of the file upload button |
autofocus | Sets or returns whether a file upload button should automatically get focus upon page load |
defaultValue | Sets or returns the default value of the file upload button |
disabled | Sets or returns whether the file upload button is disabled, or not |
files | Returns a FileList object that represents the file or files selected with the file upload button |
form | Returns a reference to the form that contains the file upload button |
multiple | Sets or returns whether a user is allowed to select more than one file in the file upload field |
name | Sets or returns the value of the name attribute of the file upload button |
required | Sets or returns whether a file in the file upload field must be selected before submitting a form |
type | Returns which type of form element the file upload button is |
value | Returns the path or the name of the selected file |
The Input Hidden object represents an HTML <input> element with type="hidden".
You can access an <input> element with type="hidden" by using getElementById():
Tip: You can also access <input type="hidden"> by searching through the elements collection of a form.
You can create an <input> element with type="hidden" by using the document.createElement() method:
Property | Description |
---|---|
defaultValue | Sets or returns the default value of the hidden input field |
form | Returns a reference to the form that contains the hidden input field |
name | Sets or returns the value of the name attribute of the hidden input field |
type | Returns which type of form element a hidden input field is |
value | Sets or returns the value of the value attribute of the hidden input field |
The Input Image object represents an HTML <input> element with type="image".
You can access an <input> element with type="image" by using getElementById():
Tip: You can also access <input type="image"> by searching through the elements collection of a form.
You can create an <input> element with type="image" by using the document.createElement() method:
Property | Description |
---|---|
alt | Sets or returns the value of the alt attribute of an input image |
autofocus | Sets or returns whether an input image should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of an input image |
disabled | Sets or returns whether an input image is disabled, or not |
form | Returns a reference to the form that contains the input image |
formAction | Sets or returns the value of the formaction attribute of an input image |
formEnctype | Sets or returns the value of the formenctype attribute of an input image |
formMethod | Sets or returns the value of the formmethod attribute of an input image |
formNoValidate | Sets or returns whether the form-data should be validated or not, on submission |
formTarget | Sets or returns the value of the formtarget attribute an input image |
height | Sets or returns the value of the height attribute of the input image |
name | Sets or returns the value of the name attribute of an input image |
src | Sets or returns the value of the src attribute of the input image |
type | Returns which type of form element the input image is |
value | Sets or returns the value of the value attribute of an input image |
width | Sets or returns the value of the width attribute of the input image |
The Input Month Object is new in HTML5.
The Input Month object represents an HTML <input> element with type="month".
Note: <input> elements with type="month" do not show as any date field/calendar in Firefox, or in IE11 and earlier versions.
You can access an <input> element with type="month" by using getElementById():
Tip: You can also access <input type="month"> by searching through the elements collection of a form.
You can create an <input> element with type="month" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a month field |
autofocus | Sets or returns whether a month field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a month field |
disabled | Sets or returns whether a month field is disabled, or not |
form | Returns a reference to the form that contains the month field |
list | Returns a reference to the datalist that contains the month field |
max | Sets or returns the value of the max attribute of the month field |
min | Sets or returns the value of the min attribute of the month field |
name | Sets or returns the value of the name attribute of a month field |
readOnly | Sets or returns whether the month field is read-only, or not |
required | Sets or returns whether the month field must be filled out before submitting a form |
step | Sets or returns the value of the step attribute of the month field |
type | Returns which type of form element the month field is |
value | Sets or returns the value of the value attribute of a month field |
Method | Description |
---|---|
stepDown() | Decrements the value of the month field by a specified number |
stepUp() | Increments the value of the month field by a specified number |
The Input Number Object is new in HTML5.
The Input Number object represents an HTML <input> element with type="number".
Note: <input> elements with type="number" are not supported in Internet Explorer 9 and earlier versions.
You can access an <input> element with type="number" by using getElementById():
Tip: You can also access <input type="number"> by searching through the elements collection of a form.
You can create an <input> element with type="number" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a number field |
autofocus | Sets or returns whether a number field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a number field |
disabled | Sets or returns whether a number field is disabled, or not |
form | Returns a reference to the form that contains the number field |
list | Returns a reference to the datalist that contains the number field |
max | Sets or returns the value of the max attribute of a number field |
min | Sets or returns the value of the min attribute of a number field |
name | Sets or returns the value of the name attribute of a number field |
placeholder | Sets or returns the value of the placeholder attribute of a number field |
readOnly | Sets or returns whether the number field is read-only, or not |
required | Sets or returns whether the number field must be filled out before submitting a form |
step | Sets or returns the value of the step attribute of a number field |
type | Returns which type of form element the number field is |
value | Sets or returns the value of the value attribute of a number field |
Method | Description |
---|---|
stepDown() | Decrements the value of the input number by a specified number |
stepUp() | Increments the value of the input number by a specified number |
The Input Password object represents an HTML <input> element with type="password".
You can access an <input> element with type="password" by using getElementById():
Tip: You can also access <input type="password"> by searching through the elements collection of a form.
You can create an <input> element with type="password" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a password field |
autofocus | Sets or returns whether a password field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a password field |
disabled | Sets or returns whether the password field is disabled, or not |
form | Returns a reference to the form that contains the password field |
maxLength | Sets or returns the value of the maxlength attribute of a password field |
name | Sets or returns the value of the name attribute of a password field |
pattern | Sets or returns the value of the pattern attribute of a password field |
placeholder | Sets or returns the value of the placeholder attribute of a password field |
readOnly | Sets or returns whether a password field is read-only, or not |
required | Sets or returns whether the password field must be filled out before submitting a form |
size | Sets or returns the value of the size attribute of a password field |
type | Returns which type of form element a password field is |
value | Sets or returns the value of the value attribute of the password field |
Method | Description |
---|---|
select() | Selects the content of a password field |
The Input Radio object represents an HTML <input> element with type="radio".
You can access an <input> element with type="radio" by using getElementById():
Tip: You can also access <input type="radio"> by searching through the elements collection of a form.
You can create an <input> element with type="radio" by using the document.createElement() method:
Property | Description |
---|---|
autofocus | Sets or returns whether a radio button should automatically get focus when the page loads |
checked | Sets or returns the checked state of a radio button |
defaultChecked | Returns the default value of the checked attribute |
defaultValue | Sets or returns the default value of a radio button |
disabled | Sets or returns whether the radio button is disabled, or not |
form | Returns a reference to the form that contains the radio button |
name | Sets or returns the value of the name attribute of a radio button |
required | Sets or returns whether the radio button must be checked before submitting a form |
type | Returns which type of form element the radio button is |
value | Sets or returns the value of the value attribute of the radio button |
The Input Range Object is new in HTML5.
The Input Range object represents an HTML <input> element with type="range".
Note: <input> elements with type="range" are not supported in Internet Explorer 9 and earlier versions.
You can access an <input> element with type="range" by using getElementById():
Tip: You can also access <input type="range"> by searching through the elements collection of a form.
You can create an <input> element with type="range" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a slider control |
autofocus | Sets or returns whether a slider control should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a slider control |
disabled | Sets or returns whether a slider control is disabled, or not |
form | Returns a reference to the form that contains the slider control |
list | Returns a reference to the datalist that contains the slider control |
max | Sets or returns the value of the max attribute of the slider control |
min | Sets or returns the value of the min attribute of the slider control |
name | Sets or returns the value of the name attribute of a slider control |
step | Sets or returns the value of the step attribute of the slider control |
type | Returns which type of form element the slider control is |
value | Sets or returns the value of the value attribute of a slider control |
Method | Description |
---|---|
stepDown() | Decrements the value of the slider control by a specified number |
stepUp() | Increments the value of the slider control by a specified number |
The Input Reset object represents an HTML <input> element with type="reset".
You can access an <input> element with type="reset" by using getElementById():
Tip: You can also access <input type="reset"> by searching through the elements collection of a form.
You can create an <input> element with type="reset" by using the document.createElement() method:
Property | Description |
---|---|
autofocus | Sets or returns whether a reset button should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a reset button |
disabled | Sets or returns whether the reset button is disabled, or not |
form | Returns a reference to the form that contains the reset button |
name | Sets or returns the value of the name attribute of a reset button |
type | Returns which type of form element the reset button is |
value | Sets or returns the value of the value attribute of the reset button |
The Input Search Object is new in HTML5.
The Input Search object represents an HTML <input> element with type="search".
You can access an <input> element with type="search" by using getElementById():
Tip: You can also access <input type="search"> by searching through the elements collection of a form.
You can create an <input> element with type="search" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a search field |
autofocus | Sets or returns whether a search field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a search field |
disabled | Sets or returns whether a search field is disabled, or not |
form | Returns a reference to the form that contains the search field |
list | Returns a reference to the datalist that contains the search field |
maxLength | Sets or returns the value of the maxlength attribute of a search field |
name | Sets or returns the value of the name attribute of a search field |
pattern | Sets or returns the value of the pattern attribute of a search field |
placeholder | Sets or returns the value of the placeholder attribute of a search field |
readOnly | Sets or returns whether the search field is read-only, or not |
required | Sets or returns whether the search field must be filled out before submitting a form |
size | Sets or returns the value of the size attribute of the search field |
type | Returns which type of form element the search field is |
value | Sets or returns the value of the value attribute of a search field |
The Input Submit object represents an HTML <input> element with type="submit".
You can access an <input> element with type="submit" by using getElementById():
Tip: You can also access <input type="submit"> by searching through the elements collection of a form.
You can create an <input> element with type="submit" by using the document.createElement() method:
Property | Description |
---|---|
autofocus | Sets or returns whether a submit button should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a submit button |
disabled | Sets or returns whether the submit button is disabled, or not |
form | Returns a reference to the form that contains the submit button |
formAction | Sets or returns the value of the formaction attribute of a submit button |
formEnctype | Sets or returns the value of the formenctype attribute of a submit button |
formMethod | Sets or returns the value of the formmethod attribute of a submit button |
formNoValidate | Sets or returns whether the form-data should be validated or not, on submission |
formTarget | Sets or returns the value of the formtarget attribute of a submit button |
name | Sets or returns the value of the name attribute of a submit button |
type | Returns which type of form element the submit button is |
value | Sets or returns the value of the value attribute of the submit button |
The Input Text object represents an HTML <input> element with type="text".
You can access an <input> element with type="text" by using getElementById():
Tip: You can also access <input type="text"> by searching through the elements collection of a form.
You can create an <input> element with type="text" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a text field |
autofocus | Sets or returns whether a text field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a text field |
disabled | Sets or returns whether the text field is disabled, or not |
form | Returns a reference to the form that contains the text field |
list | Returns a reference to the datalist that contains the text field |
maxLength | Sets or returns the value of the maxlength attribute of a text field |
name | Sets or returns the value of the name attribute of a text field |
pattern | Sets or returns the value of the pattern attribute of a text field |
placeholder | Sets or returns the value of the placeholder attribute of a text field |
readOnly | Sets or returns whether a text field is read-only, or not |
required | Sets or returns whether the text field must be filled out before submitting a form |
size | Sets or returns the value of the size attribute of a text field |
type | Returns which type of form element a text field is |
value | Sets or returns the value of the value attribute of the text field |
The Input Time object represents an HTML <input> element with type="time".
Note: <input> elements with type="time" do not show as any time field in Firefox, or in IE12 and earlier versions.
You can access an <input> element with type="time" by using getElementById():
Tip: You can also access <input type="time"> by searching through the elements collection of a form.
You can create an <input> element with type="time" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a time field |
autofocus | Sets or returns whether a time field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a time field |
disabled | Sets or returns whether a time field is disabled, or not |
form | Returns a reference to the form that contains the time field |
list | Returns a reference to the datalist that contains the time field |
max | Sets or returns the value of the max attribute of the time field |
min | Sets or returns the value of the min attribute of the time field |
name | Sets or returns the value of the name attribute of a time field |
readOnly | Sets or returns whether the time field is read-only, or not |
required | Sets or returns whether the time field must be filled out before submitting a form |
step | Sets or returns the value of the step attribute of the time field |
type | Returns which type of form element the time field is |
value | Sets or returns the value of the value attribute of a time field |
Method | Description |
---|---|
stepDown() | Decrements the value of the time field by a specified number |
stepUp() | Increments the value of the time field by a specified number |
The Input URL Object is new in HTML5.
The Input URL object represents an HTML <input> element with type="url".
Note: <input> elements with type="url" are not supported in Internet Explorer 9 (and earlier versions), or Safari.
You can access an <input> element with type="url" by using getElementById():
Tip: You can also access <input type="url"> by searching through the elements collection of a form.
You can create an <input> element with type="url" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a URL field |
autofocus | Sets or returns whether a URL field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a URL field |
disabled | Sets or returns whether a URL field is disabled, or not |
form | Returns a reference to the form that contains the URL field |
list | Returns a reference to the datalist that contains the URL field |
maxLength | Sets or returns the value of the maxlength attribute of a URL field |
name | Sets or returns the value of the name attribute of a URL field |
pattern | Sets or returns the value of the pattern attribute of a URL field |
placeholder | Sets or returns the value of the placeholder attribute of a URL field |
readOnly | Sets or returns whether the URL field is read-only, or not |
required | Sets or returns whether the URL field must be filled out before submitting a form |
size | Sets or returns the value of the size attribute of the URL field |
type | Returns which type of form element the URL field is |
value | Sets or returns the value of the value attribute of a URL field |
The Input Week Object is new in HTML5.
The Input Week object represents an HTML <input> element with type="week".
Note: <input> elements with type="week" are not supported in Firefox, or in IE12 and earlier versions.
You can access an <input> element with type="week" by using getElementById():
Tip: You can also access <input type="week"> by searching through the elements collection of a form.
You can create an <input> element with type="week" by using the document.createElement() method:
Property | Description |
---|---|
autocomplete | Sets or returns the value of the autocomplete attribute of a week field |
autofocus | Sets or returns whether a week field should automatically get focus when the page loads |
defaultValue | Sets or returns the default value of a week field |
disabled | Sets or returns whether a week field is disabled, or not |
form | Returns a reference to the form that contains the week field |
list | Returns a reference to the datalist that contains the week field |
max | Sets or returns the value of the max attribute of the week field |
min | Sets or returns the value of the min attribute of the week field |
name | Sets or returns the value of the name attribute of a week field |
readOnly | Sets or returns whether the week field is read-only, or not |
required | Sets or returns whether the week field must be filled out before submitting a form |
step | Sets or returns the value of the step attribute of the week field |
type | Returns which type of form element the week field is |
value | Sets or returns the value of the value attribute of a week field |
Method | Description |
---|---|
stepDown() | Decrements the value of the week field by a specified number |
stepUp() | Increments the value of the week field by a specified number |
HTML tutorial: HTML Forms
HTML reference: HTML <input> tag
HTML reference: HTML <input> type attribute