Layui 总结(3)laydate 日期插件 添加选择范围

开发思路
   1.在要添加地方 给 test1 添加点击事件  当 点击的前提条件发生 再发生如下事情
   2. 在DOM元素 before 或者after 添加dom
   3. 添加dom之后 给dom设计点击事件  模拟用户点击           

 

   $("#test1").click(function () {
      if (!$("#shangxun")[0]) {
        $(".laydate-btns-clear").before('<span class="laydate-btns-clear " id="shangxun" style="margin-right:20px">上旬</span>')
        $(".laydate-btns-clear:eq(0)").after('<span class="laydate-btns-clear " id="zhongxun" style="margin-right:20px">中旬</span>')
        $(".laydate-btns-clear:eq(1)").after('<span class="laydate-btns-clear " id="xiaxun" style="margin-right:200px">下旬</span>')
        
        $("#shangxun").click(function () {
          $(".layui-laydate-content td:not(.laydate-day-prev):eq(0)").click();
          $(".layui-laydate-content td:not(.laydate-day-prev):eq(9)").click();
        })
        $("#zhongxun").click(function () {
          $(".layui-laydate-content td:not(.laydate-day-prev):eq(10)").click();
          $(".layui-laydate-content td:not(.laydate-day-prev):eq(19)").click();
        })
        $("#xiaxun").click(function () {
          $(".layui-laydate-content td:not(.laydate-day-prev):eq(20)").click();
          $(".laydate-day-next:first").prev().click();
          console.log($(".laydate-day-next:first").prev())
        })
        
      }
    })

  

转载于:https://www.cnblogs.com/nice2018/p/10854936.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值