layui time controls laydate

Click mainly to solve the year immediately close the Control pop implement controls and flash back problem

< Div class = "DATE-Box" > 
   date selection: 
   < INPUT ID = "XL-2" type = "text" class = "DATE" placeholder = "Choose Time"  /> 
</ div >

 

1, immediately close the Control pop achieve

Click on the year finished immediately take effect, and not only have to click OK to close the pop

2. flash back

layui.use ([ "Table", "laydate", 'form', 'Element'], function () { 
        
          var laydate = layui.laydate; 
          laydate.render ({ 
              elem: '# XL-2', // specified elements 
              of the type: 'year', // free to choose the time 
              format: 'yyyy' , 
              value: yearUnline, 
              showBottom: false , 
              the Trigger: 'the Click', // address multiple time controls in a flash back page of 
              Change: function (value , date, endDate) {// trigger after selection time 
                  $ ( '# XL-2' ) .val (value);
                  $ ( '.Layui-laydate') Remove ();. // Close Time Controls 
                  

              } 
          }); 
          
});

 

Guess you like

Origin www.cnblogs.com/bbllw/p/11242329.html