bootstrap datepicker只能选择小于今天的日期

1、html代码

        <div class="date-picker pull-left">
            <div id="datepicker"></div>
            <div>
                <div class="input-group pull-left">
                    <span class="input-group-addon left-addon">
                        <img src="~/assets/img/datepicker-icon.png">
                    </span>
                    <input type="text" id="dp" name="dp" placeholder="加入开始日" value="" class="date-input">
                    <span class="input-group-addon right-addon"><i class="fa fa-angle-down"></i></span>
                </div>
                <div class="input-group pull-left" style="margin-left: 30px;">
                    <span class="input-group-addon left-addon">
                        <img src="~/assets/img/datepicker-icon.png">
                    </span>
                    <input type="text" id="end" name="end" placeholder="加入结束日" value="" class="date-input">
                    <span class="input-group-addon right-addon"><i class="fa fa-angle-down"></i></span>
                </div>
            </div>
        </div>

2、js代码

$('#dp').datepicker({
    todayBtn: "linked",
    autoclose: true,
    todayHighlight: true,
    endDate: new Date()
});
$('#end').datepicker({
    todayBtn: "linked",
    autoclose: true,
    todayHighlight: true,
    endDate: new Date()
});

 

posted @ 2017-12-02 19:10  吃辣椒的小毛驴  阅读(4456)  评论(0编辑  收藏  举报