HTML DOM Input Week stepUp( ) Method

HTMLWeb DevelopmentFront End Technology

The HTML DOM Input Week stepUp() method defines the amount of weeks the week field should increase.

Syntax

Following is the syntax −

Calling stepUp() method with a number, which by default is equal to 1

inputWeekObject.stepUp(number)

Example

Let us see an example for Input Week stepUp() method −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>Input Week stepUp()</title>
<style>
   form {
      width:70%;
      margin: 0 auto;
      text-align: center;
   }
   * {
      padding: 2px;
      margin:5px;
   }
   input[type="button"] {
      border-radius: 10px;
   }
</style>
</head>
<body>
<form>
<fieldset>
<legend>Week-stepUp( )</legend>
<label for="WeekSelect">Week and Year :
<input type="week" id="WeekSelect" value="2006-W44">
</label>
<input type="button" onclick="changeStep('25')" value="Increase Weeks by 25">
<input type="button" onclick="changeStep('50')" value="Increase Weeks by 50">
</fieldset>
</form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var inputWeek = document.getElementById("WeekSelect");
   function changeStep(myStep) {
      inputWeek.stepUp(myStep);
   }
</script>
</body>
</html>

Output

This will produce the following output −

Before clicking any button −

Clicking ‘Increase Weeks by 25’ button −

Clicking ‘Increase Weeks by 50’ button −

raja
Published on 29-Jul-2019 08:12:10
Advertisements