jQuery UI Datepicker Range

前端 未结 4 1658
半阙折子戏
半阙折子戏 2021-01-14 10:47

I asked a pretty similar question a few days ago, but this one is different enough that I didn\'t feel like derailing the other helpful topic. I basically want to set up two

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-14 11:31

    $(function() {
    
        $('#txtStartDate, #txtEndDate').datepicker({
            showOn: "both",
            beforeShow: customRange,
            dateFormat: "dd M yy",
        });
    
    });
    
    function customRange(input) {
    
        if (input.id == 'txtEndDate') {
            var minDate = new Date($('#txtStartDate').val());
            minDate.setDate(minDate.getDate() + 1)
    
            return {
                minDate: minDate
    
            };
        }
    
    }​
    

    crazy demo

提交回复
热议问题