HTML DOM Input Week Object

Input Week object

The Input Week object is a new object in HTML5.

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

Note:Internet Explorer or Firefox does not support the <input type="week"> element.

Access the Input Week object

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

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

Try It Yourself

Tip:You can also traverse the form's elements collection To access the Input Week object.

Create an Input Week object

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

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

Try It Yourself

Input Week object properties

Properties Description
autocomplete Set or return the value of the week field's autocomplete attribute.
autofocus Set or return whether the week field should automatically focus after the page is loaded.
defaultValue Set or return the default value of the week field.
disabled Set or return whether the week field is disabled.
form Return a reference to the form containing the week field.
list Return a reference to the datalist containing the week field.
max Set or return the value of the week field's max attribute.
min Set or return the value of the week field's min attribute.
name Set or return the value of the week field's name attribute.
readOnly Set or return whether the week field is read-only.
required Set or return whether the week field must be filled out before submitting the form.
step Set or return the value of the week field's step attribute.
type Return the form element type of the week field.
value Set or return the value of the week field's value attribute.

Input Week object methods

Method Description
select() Select the content of the week text field.
stepDown() Decrement the value of the week field by a specified number.
stepUp() Increment the value of the week field by a specified number.

Standard attributes and events

The Input Week object supports standardsPropertiesAndEvents.

Related Pages

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML <input> tag

HTML Reference Manual:HTML <input> type attribute