bootstrap画的页面很漂亮,能自动适应网页端,移动端。实现一个双选时间控件:

要得jar包自己去下

一、页面

二、JS

var $createTime=$('#createTime');
$createTime.daterangepicker({
ranges : {
//'最近1小时': [moment().subtract('hours',1), moment()],
'今日': [moment().startOf('day'), moment()],
'昨日': [moment().subtract(1,'days').startOf('day'), moment().subtract(1,'days').endOf('day')],
'最近7日': [moment().subtract(6,'days'), moment()],
'最近30日': [moment().subtract(29,'days'), moment()]
},
"alwaysShowCalendars": true,
"opens": "right",
locale : {
format : 'YYYY-MM-DD',
applyLabel : '确定',
cancelLabel : '取消',
fromLabel : '起始时间',
toLabel : '结束时间',
customRangeLabel : '自定义',
daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',
'七月', '八月', '九月', '十月', '十一月', '十二月' ],
firstDay : 1
}
}, function (start, end) {
$("#startTime").val(start.format('YYYY-MM-DD HH:mm:ss'));
$("#endTime").val(end.format('YYYY-MM-DD HH:mm:ss'));
});
$createTime.on('cancel.daterangepicker',function () {
$(this).val('');
$("#startTime").val('');
$("#endTime").val('');
});
$createTime.on('apply.daterangepicker',function (el,daterangepicker) {
var start=daterangepicker.startDate;
var end=daterangepicker.endDate;
$("#startTime").val(start.format('YYYY-MM-DD HH:mm:ss'));
$("#endTime").val(end.format('YYYY-MM-DD HH:mm:ss'));
});

bootstrap下的双选时间插件使用方法的更多相关文章

  1. linux和windows双系统时间错误解决方法

    转自http://www.2cto.com/os/201204/126212.html windows时间会慢8小时,原因: 两个概念: UTC即Universal Time Coordinated, ...

  2. bootstrap下,对数组循环处理的方法

    nameArray和nameArrayCurrent是字符数组 $.each(nameArray, function(i, v) { if($.inArray(v, nameArrayCurrent) ...

  3. Win/Lin 双系统时间错误的调整 (转)

    Win/Lin 双系统时间错误的调整 http://jingyan.baidu.com/article/154b46317b25ca28ca8f41e8.html | 浏览:1070 | 更新:201 ...

  4. bootstrap时间插件 火狐不显示 完美解决方法

    原文链接:http://www.phpbiji.cn/article/index/id/141/cid/4.html bootstrap时间插件火狐 bootstrap-datetimepicker火 ...

  5. selenium 难定位元素,时间插件,下拉框定位,string

    1.元素定位 ID定位元素: findElement(By.id(“”)); 通过元素的名称定位元素: findElement(By.name(“”)); 通过元素的html中的位置定位元素: fin ...

  6. 【bootstrap】使用支持bootstrap的时间插件daterangepicker

    其中的架包和代码,具体可以去GitHub下查看: https://github.com/AngelSXD/myagenorderdiscount 1.引入js和css <link href=&q ...

  7. angularjs封装bootstrap官网的时间插件datetimepicker

    背景:angular与jquery类库的协作 第三方类库中,不得不提的是大名鼎鼎的jquery,现在基本上已经是国内web开发的必修工具了.它灵活的dom操作,让很多web开发人员欲罢不能.再加上已经 ...

  8. 我的第一个jquery插件:下拉多选框

    <!DOCTYPE HTML> <html> <head> <title> New Document </title> <meta n ...

  9. jquery 下拉多选插件

    Jquery多选下拉列表插件jquery multiselect功能介绍及使用 Chosen 替代样式表 Bootstrap Chosen

随机推荐

  1. phpexecl 的基本操作

    基本使用方法分三部分:一.引入接口 // PHPExcel_IOFactory require_once dirname(__FILE__).'/Classes/PHPExcel/IOFactory. ...

  2. AcWing算法基础1.1

    排序 快速排序(快排) 写题的时候用的不多基本都是直接sort ( ),面试可能要手撸快排,上模板 void quick_sort(int q[], int l, int r) { if(l > ...

  3. VUE修改每个页面title

    //index.js routes: [ { name:'home', path: '/home/:openname', component: Home, meta: { title: '首页' } ...

  4. Map,Filter 和 Reduce

    Map会将一个函数映射到一个输入列表的所有元素上 map(function_to_apply, list_of_inputs) items = [1, 2, 3, 4, 5] squared = li ...

  5. Elasticsearch集群状态健康值处于red状态问题分析与解决(图文详解)

      问题详情 我的es集群,开启后,都好久了,一直报red状态??? 问题分析 有两个分片数据好像丢了.   不知道你这数据怎么丢的. 确认下本地到底还有没有,本地要是确认没了,那数据就丢了,删除索引 ...

  6. python--9、并发之多进程应用

    multiprocessing模块 想要充分地使用多核CPU的资源(os.cpu_count()查看),在python中大部分情况需要使用多进程.Python提供了multiprocessing.  ...

  7. service里设置websocket心跳并向fragment发送数据

    垃圾小白写了自己看的 /** * service 文件 */ public class SocketService extends Service { //自己定义接口用来传参 private sta ...

  8. JS——属性绑定

    1.普通形式 <script> var stu = new Object(); stu.name = "ww"; console.log(stu);//{name: & ...

  9. html——行内元素、块元素、行内块元素

    行内元素:span  ,a,  ,strong , em,  del,  ins.特点:在一行上显示:不能直接设置宽高:元素的宽和高就是内容撑开的宽高. 块元素:div,h1-h6,p,ul,li.特 ...

  10. linux下tomcat启动正常,但是外部浏览器无法访问

    这种情况一般是由于系统防火墙设置问题导致的,这次遇到的系统是centos 7.2,防火墙由iptables改成了firewall,因此停止防火墙的命令应该是: systemctl disable fi ...