jquery双日历插件daterangepicker.js使用方法及设置值

来源:互联网 发布:js获取表单某个数据 编辑:程序博客网 时间:2024/05/22 04:57

1、 使用方法

<input type="text" class="form-control start-time" placeholder="运营费起算时间" value="2016-12-01">$('.start-time',$currentTab).daterangepicker(null, function(start, end, label) {        $scope.start_time = start.format('YYYY-MM-DD')//格式化日期    });

2、 设置值
在input的value直接写值

<input type="text" class="form-control start-time" placeholder="运营费起算时间" value="2016-12-01">

通过js设置input的值

$('.start-time').val('2016-12-06');

3、设置成单日历
只需要在初始化的时候设置参数singleDatePicker为true

$('.start-time',$currentTab).daterangepicker({            singleDatePicker: true,//设置成单日历        }, function(start, end, label) {            $scope.start_time = start.format('YYYY-MM-DD')//格式化日期        });
0 0
原创粉丝点击