mardi 24 novembre 2015

How to combine checkbox with jquery Datepicker

I want to combine checkbox with jquery Datepicker such that when checkbox is checked, the datepicker should become disable & show predefined date.

$(function() {
    $( "#from" ).datepicker({
      defaultDate: "today",
      changeMonth: true, dateFormat: 'yy-mm-dd 00:00:00',
      onClose: function( selectedDate ) {
        $( "#to" ).datepicker( "option", "minDate", selectedDate );
      }
    });
    $( "#to" ).datepicker({
      defaultDate: "today",
      changeMonth: true,dateFormat: 'yy-mm-dd 00:00:00',
      onClose: function( selectedDate ) {
        $( "#from" ).datepicker( "option", "maxDate", selectedDate );
      }
    });
  });

Once checkbox is checked then - from = 2000-11-04 00:00:00 & to = today's date. I am passing these values to HTML Form.

Please help me.




Aucun commentaire:

Enregistrer un commentaire