Input Week step Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Week

Description

The step property sets or gets the step attribute of a week field, which identifies 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.

Set the step property with the following Values

Value Description
number Sets 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.

Return Value

A Number, representing the legal week intervals

The following code shows how to change the legal week intervals:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="week" id="myWeek" value="2018-W15">

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from  w w w.  j  a v  a2s . c o  m*/
    document.getElementById("myWeek").stepUp();
}
</script>

</body>
</html>

Related Tutorials