THE WORLD'S LARGEST WEB DEVELOPER SITE

Input Week step Property

❮ Input Week Object

Example

Change the legal week intervals:

document.getElementById("myWeek").step = "2";
Try it Yourself »

Definition and Usage

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

The step attribute specifies the legal week intervals to choose from when the user opens the calendar in a week field.

For example, if step = "2", you can only select every second week in the calendar.


Browser Support

Property
step Yes 10.0 Yes Yes Yes

Note: The <input type="week"> element does not show any date field/calendar in Firefox.


Syntax

Return the step property:

weekObject.step

Set the step property:

weekObject.step = number

Property Values

Value Description
number Specifies the legal week intervals. Default is 1 week.

Examples:

If step="2", you can only select every second week in the week calendar.

If step="10", you can only select every tenth week in the week calendar.


Technical Details

Return Value: A Number, representing the legal week intervals

More Examples

Example

Get the legal week intervals:

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

The result of x will be:

3
Try it Yourself »

Related Pages

HTML reference: HTML <input> step attribute


❮ Input Week Object