HTML Input

Input Button Object
Input Button Object Properties
Input Checkbox Object
Input Checkbox Object Properties
Input Color Object
Input Color Object Properties
Input Date Object
Input Date Object Properties
Input Date Object Methods
Input Datetime Object
Input Datetime Object Properties
Input Datetime Object Methods
Input DatetimeLocal Object
Input DatetimeLocal Object Properties
Input DatetimeLocal Object Methods
Input Email Object
Input Email Object Properties
Input FileUpload Object
Input FileUpload Object Properties
Input Hidden Object
Input Hidden Object Properties
Input Image Object
Input Image Object Properties
Input Month Object
Input Month Object Properties
Input Month Object Methods
Input Number Object
Input Number Object Properties
Input Number Object Methods
Input Password Object
Input Password Object Properties
Input Password Object Methods
Input Radio Object
Input Radio Object Properties
Input Range Object
Input Range Object Properties
Input Range Object Methods
Input Reset Object
Input Reset Object Properties
Input Search Object
Input Search Object Properties
Input Submit Object
Input Submit Object Properties
Input Text Object
Input Text Object Properties
Input Time Object
Input Time Object Properties
Input Time Object Methods
Input URL Object
Input URL Object Properties
Input Week Object
Input Week Object Properties
Input Week Object Methods



Input Button Object

The Input Button object represents an HTML <input> element with type="button".

Access an Input Button Object

You can access an <input> element with type="button" by using getElementById():

Example

var x = document.getElementById("myBtn");
Try it Yourself »

Tip: You can also access <input type="button"> by searching through the elements collection of a form.

Create an Input Button Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "button");
Try it Yourself »

Input Button Object Properties

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

Input Checkbox Object

The Input Checkbox object represents an HTML <input> element with type="checkbox".

Access an Input Checkbox Object

You can access an <input> element with type="checkbox" by using getElementById():

Example

var x = document.getElementById("myCheck");
Try it Yourself »

Tip: You can also access <input type="checkbox"> by searching through the elements collection of a form.

Create an Input Checkbox Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "checkbox");
Try it Yourself »

Input Checkbox Object Properties

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

Input Color Object HTML5

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.

Access an Input Color Object

You can access an <input> element with type="color" by using getElementById():

Example

var x = document.getElementById("myColor");
Try it Yourself »

Tip: You can also access <input type="color"> by searching through the elements collection of a form.

Create an Input Color Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "color");
Try it Yourself »

Input Color Object Properties

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

Input Date Object HTML5

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.

Access an Input Date Object

You can access an <input> element with type="date" by using getElementById():

Example

var x = document.getElementById("myDate");
Try it Yourself »

Tip: You can also access <input type="date"> by searching through the elements collection of a form.

Create an Input Date Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "date");
Try it Yourself »

Input Date Object Properties

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

Input Date Object Methods

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

Input Datetime Object HTML5

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.

Access an Input Datetime Object

You can access an <input> element with type="datetime" by using getElementById():

Example

var x = document.getElementById("myDatetime");
Try it Yourself »

Tip: You can also access <input type="datetime"> by searching through the elements collection of a form.

Create an Input Datetime Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "datetime");
Try it Yourself »

Input Datetime Object Properties

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

Input Datetime Object Methods

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

Input DatetimeLocal Object HTML5

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.

Access an Input DatetimeLocal Object

You can access an <input> element with type="datetime-local" by using getElementById():

Example

var x = document.getElementById("myLocalDate");
Try it Yourself »

Tip: You can also access <input type="datetime-local"> by searching through the elements collection of a form.

Create an Input DatetimeLocal Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "datetime-local");
Try it Yourself »

Input DatetimeLocal Object Properties

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

Input DatetimeLocal Object Methods

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

Input Email Object HTML5

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.

Access an Input Email Object

You can access an <input> element with type="email" by using getElementById():

Example

var x = document.getElementById("myEmail");
Try it Yourself »

Tip: You can also access <input type="email"> by searching through the elements collection of a form.

Create an Input Email Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "email");
Try it Yourself »

Input Email Object Properties

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

Input FileUpload Object

The Input FileUpload object represents an HTML <input> element with type="file".

Access an Input FileUpload Object

You can access an <input> element with type="file" by using getElementById():

Example

var x = document.getElementById("myFile");
Try it Yourself »

Tip: You can also access <input type="file"> by searching through the elements collection of a form.

Create an Input FileUpload Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "file");
Try it Yourself »

Input FileUpload Object Properties

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

Input Hidden Object

The Input Hidden object represents an HTML <input> element with type="hidden".

Access an Input Hidden Object

You can access an <input> element with type="hidden" by using getElementById():

Example

var x = document.getElementById("myInput");
Try it Yourself »

Tip: You can also access <input type="hidden"> by searching through the elements collection of a form.

Create an Input Hidden Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "hidden");
Try it Yourself »

Input Hidden Object Properties

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

Input Image Object

The Input Image object represents an HTML <input> element with type="image".

Access an Input Image Object

You can access an <input> element with type="image" by using getElementById():

var x = document.getElementById("myImage");

Tip: You can also access <input type="image"> by searching through the elements collection of a form.

Create an Input Image Object

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

var x = document.createElement("INPUT");
x.setAttribute("type", "image");

Input Image Object Properties

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

Input Month Object HTML5

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.

Access an Input Month Object

You can access an <input> element with type="month" by using getElementById():

Example

var x = document.getElementById("myMonth");
Try it Yourself »

Tip: You can also access <input type="month"> by searching through the elements collection of a form.

Create an Input Month Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "month");
Try it Yourself »

Input Month Object Properties

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

Input Month Object Methods

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

Input Number Object HTML5

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.

Access an Input Number Object

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

Example

var x = document.getElementById("myNumber");
Try it Yourself »

Tip: You can also access <input type="number"> by searching through the elements collection of a form.

Create an Input Number Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "number");
Try it Yourself »

Input Number Object Properties

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

Input Number Object Methods

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

Input Password Object

The Input Password object represents an HTML <input> element with type="password".

Access an Input Password Object

You can access an <input> element with type="password" by using getElementById():

Example

var x = document.getElementById("myPsw");
Try it Yourself »

Tip: You can also access <input type="password"> by searching through the elements collection of a form.

Create an Input Password Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "password");
Try it Yourself »

Input Password Object Properties

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

Input Password Object Methods

Method Description
select() Selects the content of a password field

Input Radio Object

The Input Radio object represents an HTML <input> element with type="radio".

Access an Input Radio Object

You can access an <input> element with type="radio" by using getElementById():

Example

var x = document.getElementById("myRadio");
Try it Yourself »

Tip: You can also access <input type="radio"> by searching through the elements collection of a form.

Create an Input Radio Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "radio");
Try it Yourself »

Input Radio Object Properties

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

Input Range Object HTML5

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.

Access an Input Range Object

You can access an <input> element with type="range" by using getElementById():

Example

var x = document.getElementById("myRange");
Try it Yourself »

Tip: You can also access <input type="range"> by searching through the elements collection of a form.

Create an Input Range Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "range");
Try it Yourself »

Input Range Object Properties

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

Input Range Object Methods

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

Input Reset Object

The Input Reset object represents an HTML <input> element with type="reset".

Access an Input Reset Object

You can access an <input> element with type="reset" by using getElementById():

Example

var x = document.getElementById("myReset");
Try it Yourself »

Tip: You can also access <input type="reset"> by searching through the elements collection of a form.

Create an Input Reset Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "reset");
Try it Yourself »

Input Reset Object Properties

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

Input Search Object HTML5

The Input Search Object is new in HTML5.

The Input Search object represents an HTML <input> element with type="search".

Access an Input Search Object

You can access an <input> element with type="search" by using getElementById():

Example

var x = document.getElementById("mySearch");
Try it Yourself »

Tip: You can also access <input type="search"> by searching through the elements collection of a form.

Create an Input Search Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "search");
Try it Yourself »

Input Search Object Properties

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

Input Submit Object

The Input Submit object represents an HTML <input> element with type="submit".

Access an Input Submit Object

You can access an <input> element with type="submit" by using getElementById():

Example

var x = document.getElementById("mySubmit");
Try it Yourself »

Tip: You can also access <input type="submit"> by searching through the elements collection of a form.

Create an Input Submit Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "submit");
Try it Yourself »

Input Submit Object Properties

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

Input Text Object

The Input Text object represents an HTML <input> element with type="text".

Access an Input Text Object

You can access an <input> element with type="text" by using getElementById():

Example

var x = document.getElementById("myText");
Try it Yourself »

Tip: You can also access <input type="text"> by searching through the elements collection of a form.

Create an Input Text Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "text");
Try it Yourself »

Input Text Object Properties

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

Input Time Object

The Input Time Object is new in HTML5.

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.

Access an Input Time Object

You can access an <input> element with type="time" by using getElementById():

Example

var x = document.getElementById("myTime");
Try it Yourself »

Tip: You can also access <input type="time"> by searching through the elements collection of a form.

Create an Input Time Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "time");
Try it Yourself »

Input Time Object Properties

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

Input Time Object Methods

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

Input URL Object HTML5

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.

Access an Input URL Object

You can access an <input> element with type="url" by using getElementById():

Example

var x = document.getElementById("myUrl");
Try it Yourself »

Tip: You can also access <input type="url"> by searching through the elements collection of a form.

Create an Input URL Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "url");
Try it Yourself »

Input URL Object Properties

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

Input Week Object HTML5

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.

Access an Input Week Object

You can access an <input> element with type="week" by using getElementById():

Example

var x = document.getElementById("myWeek");
Try it Yourself »

Tip: You can also access <input type="week"> by searching through the elements collection of a form.

Create an Input Week Object

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

Example

var x = document.createElement("INPUT");
x.setAttribute("type", "week");
Try it Yourself »

Input Week Object Properties

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

Input Week Object Methods

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