本文教大家使用了laydate插件設(shè)置開始和結(jié)束時(shí)間,供大家參考,具體內(nèi)容如下
用的laydate插件是layDate-v5.0.6,是新版本的;
效果是選擇開始時(shí)間,選擇結(jié)束時(shí)間的時(shí)候開始時(shí)間之前的時(shí)間不能選;
選擇結(jié)束時(shí)間,選擇開始時(shí)間的時(shí)候結(jié)束時(shí)間之后的時(shí)間不能選;
      function time(){        //開始時(shí)間id="start",結(jié)束時(shí)間id="end";        var start = {          elem: '#start',          type:'date',          min: '2000-09-10',          max: '2333-09-20',          show: true,          closeStop: '#start'         };        var end = {          elem: '#end',          type:'date',          min: '2000-09-10',          max: '2333-09-20',          show: true,          closeStop: '#end'        };        lay('#start').on('click', function(e){          if($('#end').val() != null && $('#end').val() != undefined && $('#end').val() != ''){            start.max = $('#end').val();          }          laydate.render(start);        });        lay('#end').on('click', function(e){          if($('#start').val() != null && $('#start').val() != undefined && $('#start').val() != ''){            end.min = $('#start').val();          }          laydate.render(end);        });        }最后調(diào)用就行了;
因?yàn)槲乙昧薺query;
所以如果沒有引用jquery的;獲取元素的值可以換成原生的;
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持VeVb武林網(wǎng)。
新聞熱點(diǎn)
疑難解答