-1

I am using datepicker for the selection of start date and end date of an event.

$(function() {
    $( "#datepicker" ).datepicker();
    $( "#datepicker2" ).datepicker();
});

<input type="text" id="datepicker">
<input type="text" id="datepicker2">

Now both the date pickers are working fine except I want to restrict datepicker2 to not allow any dates less that the date already selected for datepicker

Brad
  • 11,934
  • 4
  • 45
  • 73
Mehar
  • 2,158
  • 3
  • 23
  • 46

1 Answers1

0

You can try these too

$(function() {

    $('#datepicker, #datepicker2').datepicker({
        showOn: "both",
        beforeShow: customRange,
        dateFormat: "dd M yy",
    });

});

function customRange(input) {

    if (input.id == 'datepicker2') {
        var minDate = new Date($('#datepicker').val());
        minDate.setDate(minDate.getDate() + 1)

        return {
            minDate: minDate

        };
    }

    return {}

}

Copied From jQuery UI Datepicker Range

Community
  • 1
  • 1
Shafeeque
  • 2,039
  • 2
  • 13
  • 28