Javascript DOM HTML Input Time stepUp() Method

Introduction

Increment the value of a time field by 10 minutes:

document.getElementById("myTime").stepUp(10);

Click the button to increment the value of the time field by 10 minutes.

View in separate window

<!DOCTYPE html>
<html>
<body>

Time: <input type="time" id="myTime" value="21:43:54">
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {/*from   w ww  .j  av a 2  s  . co m*/
  document.getElementById("myTime").stepUp(10);
}
</script>

</body>
</html>

The stepDown() method increments the value of the time field by a specified number.

This method will only have an affect on minutes.

Parameter
Description
number

Required. Specifies the amount of minutes the time field should increase.
If omitted, the minutes are incremented by "1"



PreviousNext

Related