JQuery Restrict the difference between two datepickers

后端 未结 4 1789
小鲜肉
小鲜肉 2021-01-24 09:04

I have 2 datepickers

  $(function() {
    $(\'#DateFrom\').datepicker({ onSelect: showUser, minDate: -90, maxDate: \"+1D\" });
  });

  $(function() {
    $(\'#         


        
4条回答
  •  没有蜡笔的小新
    2021-01-24 09:21

    A little suggestion, try finding a JQuery Range Picker. They'll include some of these tedious functionality for you already. Going on google and searching just that gives you a ton of choices.

    etc..https://github.com/longbill/jquery-date-range-picker

    Back to the question though, you could put a callback function on 'onClose' in 'DateFrom' so that whenever the date is change, you will change the 'minDate' on 'DateTo' as well.

提交回复
热议问题