HTML DOM Input Date step Property


The HTML DOM Input Date step property determines the legal day intervals to choose from when user opens the calendar. It sets or returns the input date step attribute value.

Syntax

Following is the syntax −

  • Returning number value
inputDateObject.step
  • Setting value attribute to a number value
inputDateObject.step = number

Example

Let us see an example of Input Date step property −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>Input Date required</title>
</head>
<body>
<form>
<div>
Odd Days Calendar: <input type="date" id="dateSelect" step="2">
</div>
</form>
<div id="divDisplay"></div>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var inputDate = document.getElementById("dateSelect");
   divDisplay.textContent = 'Current step: '+inputDate.step;
</script>
</body>
</html>

Output

This will produce the following output. Here, step was set to 2 −

Updated on: 13-Jun-2020

173 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements