HTML DOM Input Week Object


Input Week Object

The Input Week object is new in HTML5.

The Input Week object represents an HTML <input> element with type="week".

Note:Internet Explorer and Firefox do not support the HTML <input> element with type="week".

Access an Input Week Object

You can use the getElementById() function to access an <input> element with type="week":

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

Tip:You can also use the form'selementscollection to access the Input Week object.

Create an Input Week Object

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

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 the week field
autofocus Sets or returns whether the week field automatically gets focus when the page loads
defaultValue Sets or returns the default value of the week field
disabled Sets or returns whether the week field is disabled
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 the week field
readOnly Sets or returns whether the week field is read-only
required Sets or returns whether the week field is required in the form
step Sets or returns the value of the step attribute of the week field
type Returns the type of form element the week field is
value Sets or returns the value of the value attribute of the week field

Standard Properties and Events

The Input Week object also supports the standardpropertiesandevents。


Related Articles

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML <input> Tag

HTML Reference Manual:HTML <input> type Attribute

Other Extensions