Here i have explained how to Set Start and End Date Range in jQuery UI Datepicker.

Step 1) Add HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Set Start and End Date Range in jQuery UI Datepicker</title>
<link type="text/css" href="css/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script>
<script type="text/javascript">
    $(function () {
        var dates = $("#txtFrom, #txtTo").datepicker({
            minDate: '0',
            maxDate: '+7D',
            onSelect: function (selectedDate) {
                var option = this.id == "txtFrom" ? "minDate" : "maxDate",
instance = $(this).data("datepicker"),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings);
                dates.not(this).datepicker("option", option, date);
            }
        });
    });
</script>
</head>
<body>
<form id="form1" runat="server">
<h1> Set Start and End Date Range in jQuery UI Datepicker</h1>

<label for="from">From</label> <input ID="txtFrom"  type="text" />
<label for="to">to</label> <input ID="txtTo" type="text" />
</form>
</body>
</html>

Screenshot

Add Comments