How to set Date Range and Restrict Date in jQuery?

In this post, I will show you how can you set the date range to only three years from the current date in jQuery UI datepicker.this jQuey provides two options minDate and maxDate.

For example

In this code, the DatePicker is selected as 2009-12-12,change event of StartDatePicker sets the minDate of EndDatePicker.

Here's a good example :

<script type="text/javascript">

        $(function () {
            $(".date").datepicker({

                dateFormat: 'dd-mm-yy',

                minDate: new Date(),

                maxDate: '+3y',

                changeMonth:
true

            });

        });

</script>
Ebook Download
View all
Learn
View all