Input Week step attribute

Definition and usage

step Set or return the value of the step attribute of the week field.

The HTML step attribute specifies the legal interval of the week that the user can select when opening the calendar in the week field.

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

See also:

HTML Reference Manual:HTML <input> step Attribute

Instance

Example 1

Change the legal interval of the week:

document.getElementById("myWeek").step = "2";

Try it yourself

Example 2

Get the legal interval of the week:

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

Try it yourself

Syntax

Return the step attribute:

weekObject.step

Set the step attribute:

weekObject.step = number

Attribute value

Value Description
number

Specify the legal interval of the week. The default is 1 week.

For example:

If step="2", you can only select every other Sunday in the calendar.

If step="10", then only every nine weeks can be selected on the calendar on Sunday.

Technical Details

Return Value: A number, representing the legal interval of weeks.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

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