bootstrap datetimepicker2.3.11时间插件使用

changeDate: function (starttime,stoptime) { //判断时间的大小弹窗提示用户 var _t = this; if(stoptime != '' && starttime != ''){ if(stoptime < starttime){ $('#stop-date').val(''); $('#time').modal('show'); setTimeout(function(){($('#time').modal('hide'))},3000); return; } } },

timeDatapicker:function () { var _t = this; //this var startDate = $('#start-date'), //开始时间 stopDate = $('#stop-date'); //结束时间 startDate.datetimepicker({ format: 'yyyy-mm-dd', autoclose: true, minView: 2, language:'zh-CN' }).on('change',function () { //changeData方法写在change之后,是为了防止changeData有changge方法(避免冲突) var starttime = startDate.val(); var stoptime = stopDate.val(); _t.changeDate(starttime,stoptime); stopDate.datetimepicker('setStartDate',starttime); //结束时间的选择将以选择的开始时间为依据从新设置(等于开始 时间) }).on('changeDate',function () { var starttime = startDate.val(); stopDate.datetimepicker('setStartDate',starttime); //结束时间的选择将以选择的开始时间为依据从新设置(等于开始 时间) var stoptime = stopDate.val(); }); stopDate.datetimepicker({ format: 'yyyy-mm-dd', autoclose: true, minView: 2, language:'zh-CN' }).on('change',function () { var starttime = startDate.val(); var stoptime = stopDate.val(); _t.changeDate(starttime,stoptime,$(this)); }).on('changeDate',function () { var starttime = startDate.val(); var stoptime = stopDate.val(); startDate.datetimepicker('setEndDate',stoptime); stopDate.datetimepicker('setStartDate',starttime); }); },

如果大家还想深入学习,可以点击这里进行学习,再为大家附3个精彩的专题:

Bootstrap学习教程

Bootstrap实战教程

Bootstrap插件使用教程

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzzjgs.html