Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Input DatetimeLocal stepDown( ) Method
The HTML DOM Input DatetimeLocal stepdown() method defines the number of minutes the datetimeLocal field should decrease.
Syntax
Following is the syntax −
Calling stepDown method with a number, which by default is equal to 1
inputDatetimeLocalObject.stepDown(number)
Example
Let us see an example of Input DatetimeLocal stepDown method −
<!DOCTYPE html>
<html>
<head>
<title>Input DatetimeLocal stepDown()</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>Datetime-Local-stepDown( )</legend>
<label for="datetimeLocalSelect">Local Date Time :
<input type="datetime-local" id="datetimeLocalSelect" value="2010-12-21T23:50">
</label>
<input type="button" onclick="changeStep(10)" value="Decrease by 10">
<input type="button" onclick="changeStep(25)" value="Decrease by 25">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputDatetimeLocal = document.getElementById("datetimeLocalSelect");
function changeStep(myStepDown) {
inputDatetimeLocal.stepDown(myStepDown);
divDisplay.textContent = 'Current Step: '+myStepDown;
}
</script>
</body>
</html>
Output
This will produce the following output −
Before clicking any button −

Clicking ‘Decrease by 10’ button −

Clicking ‘Decrease by 25’ button −

Advertisements