Javascript DOM HTML Input Time stepDown() Method

Introduction

Decrement the value of a time field by 10 minutes:

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

Click the button to decrement 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  w w. ja v a 2s  .c  o  m*/
  document.getElementById("myTime").stepDown(10);
}
</script>

</body>
</html>

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

This method will only have an affect on minutes.

Parameter Description
numberRequired. Set the amount of minutes the time field should decrease.

If omitted, the minutes are decremented by "1"




PreviousNext

Related