Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input Week value property

Input Week value property

Input Week Object Reference The Input Week object

Example

Set the year and week of the week field:

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

Try it »


Definition and Usage

The value property sets or returns the value attribute of the week field.

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


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value attribute

Note: Internet Explorer or Firefox browsers do not support .


Syntax

Return the value attribute:

weekObject

.value

Set the value attribute:

weekObject

.value=

YYYY-

W

WW

Attribute values

Value Description
YYYY-WWW Describes the week and year. Parsed as follows:
  • YYYY - year (e.g.: 2011)
  • "-W" means "week"
  • WW - week (between 1 and 52 or 53 (depending on the year), e.g., 01 is the first week of the year)
  • Example: 2014-W15 |

    Technical Details

    Return Value: A 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;

    x

    The output is:

    1995-W35

    Try it »


    Related pages

    HTML Reference Manual: HTML value attribute


    Input Week Object Reference The Input Week object