JQuery - end date less than start date

后端 未结 6 1784
一生所求
一生所求 2020-12-16 08:12

I\'m trying to fix this problem I\'m having. I have to input tags, one is for Training beginning date and other is for training ending date. What i am trying to do is create

6条回答
  •  囚心锁ツ
    2020-12-16 08:26

    Date picker has an option to validate start date and end date.

    HTML

    jQuery

    $(document).ready(function() {
        jQuery("#from").datepicker({
            dateFormat: 'dd/mm/yy',
            changeMonth: true,
            changeYear: true,
            maxDate: '0',
            onClose: function( selectedDate ) {
            jQuery( "#to" ).datepicker( "option", "minDate", selectedDate );
            }
        });
        jQuery("#to").datepicker({
            dateFormat: 'dd/mm/yy',
            changeMonth: true,
            changeYear: true,
            maxDate: '0',
            onClose: function( selectedDate ) {
            jQuery( "#from" ).datepicker( "option", "maxDate", selectedDate );
            }
        });
    });
    

提交回复
热议问题