Input Date stepUp() Method - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Date

Description

The stepUp() method increments the days of the date field by a specified number.

Parameter Values

Parameter Description
numberRequired. the amount of days the date field should increase. If omitted, the days are incremented by "1"

Return Value:

No return value

The following code shows how to Increment the value of a date field by 5 days:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Date: <input type="date" id="myDate" value="2014-05-05">

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

<script>
function myFunction() {//from   w ww  .jav  a  2 s  .c om
    document.getElementById("myDate").stepUp(5);
}
</script>

</body>
</html>

Related Tutorials