YouTip LogoYouTip

Prop Week Value

HTML DOM Input Week value Property

HTML DOM Input Week value Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference Manual

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

<input> - url

<keygen>

Input Week value Property

Input Week Object Reference Manual Input Week Object

Example

Set the year and week of the week field:

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

Try it yourself Β»


Definition and Usage

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

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property.

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


Syntax

Return the value property:

weekObject.value

Set the value property:

weekObject.value=YYYY-WWW

Property Values

Value Description
YYYY-WWW Describes the week and year. Parsed as follows:
  • YYYY - Year (e.g., 2011)
  • "-W" means "Week"
  • WWW - 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 will output:

1995-W35

Try it yourself Β»


Related Pages

HTML Reference: HTML <input> value Attribute


Input Week Object Reference Manual Input Week Object

<input> - url

<keygen>

← Dom Obj WeekProp Week Value β†’