TonyP
TonyP

Reputation: 5873

How to set a Jquery Datepicker daterange

I have two input text boxes which is bound to jquery Datepicker widget. When user select a given date from Date1 (Effective Date), I want to set the min date of Date2 (Expiry date) to Date1 + 1 .. How do I do that, Thanks

Upvotes: 0

Views: 881

Answers (1)

Imrul
Imrul

Reputation: 3526

see this link : jQuery datepicker- 2 inputs/textboxes and restricting range

and use onChangeMonthYear function or onSelect function:

$('#txtStartDate, #txtEndDate').datepicker({
        showOn: "both",
        beforeShow: customRange,
        dateFormat: "dd M yy",
        firstDay: 1, 
        changeFirstDay: false,
        onChangeMonthYear: function(year, month, inst) { ... },
        onSelect: function(dateText, inst) { ... }
    });

and use the same technique Ben Koehler or Russ Cam used.

Upvotes: 2

Related Questions