HTML | DOM Input Date stepUp() Method

The Input Date stepUp() method in HTML DOM is used to increment the value of date field by a specified number. The Input Date stepUp() method can only be used on the days and not on months and years.

Syntax:

inputdateObject.stepUp( number )

Parameters: This method accepts single parameter number which is used to specify the amount of days the date field should increase.

Below program illustrates the Input Date stepUp method in HTML DOM:

Example: This example use Input Date stepUp() method to increment the value of date field by 2 days.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head
    <title>
        Input Date stepUp Property
    </title
</head>
  
<body style="text-align:center;">
  
    <h1 style="color:green;">
        GeeksforGeeks
    </h1
      
    <h2 style="text-align:center;">
        Input Date stepUp Property
    </h2>
      
    <input type="date" id="Test_Date">
      
    <p>
        To increase the step, double click
        the "Increase Step" button.
    </p>
      
    <button ondblclick="My_Date()">
        Increase Step
    </button>
      
    <!-- Script to use Input Date stepUp() Method -->
    <script>
        function My_Date() {
            document.getElementById("Test_Date").stepUp(2);
        }
    </script>
</body>
  
</html>                    

chevron_right


Output:
Before clicking on the button:

After clicking on the button:

Supported Browsers

  • Apple Safari
  • Internet Explorer 12.0
  • Firefox 17.0
  • Google Chrome
  • Opera


My Personal Notes arrow_drop_up

I am a technology enthusiast who has a keen interest in programming I am pursuing Engineering in Computer Science from GEU, Dehradun I like to unwind by watching movies and English sitcomsI have a keen interest in music

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.