Easy Tutorial
❮ Prop Email Size Prop Number Value ❯

Input Week value Attribute

Input Week Object

Example

Set the year and week for the week field:

document.getElementById("myWeek").value = "2014-W48";

Definition and Usage

The value attribute is used to set or return the value of the week field.

The value attribute describes the user input, default value, or value input by the script.


Browser Support

All major browsers support the value attribute.

Note: The <input type="week"> element is not supported by Internet Explorer or Firefox browsers.


Syntax

Return the value attribute:

Set the value attribute:

Attribute Values

Value Description
YYYY-W WW Describes the week and year. Parsing as follows: YYYY - Year (e.g., 2011)<br> "-W" denotes "Week"<br> WW - Week (between 1 and 52 or 53, depending on the year), e.g., 01 for the first week of the year) Example: 2014-W15

Technical Details

| Return Value: | String, representing the year and week of the week field | | --- | --- |


More Examples

Example

Get the year and week of the week field:

var x = document.getElementById("myWeek").value;
1995-W35

Related Pages

HTML Reference: HTML <input> value Attribute

❮ Prop Email Size Prop Number Value ❯