Jquery UI datepicker. Disable array of Dates

后端 未结 7 844
野的像风
野的像风 2020-11-22 02:21

I have been trying to search for a solution to my Jquery ui datepicker problem and I\'m having no luck. Here\'s what I\'m trying to do...

I have an application where

7条回答
  •  情书的邮戳
    2020-11-22 02:55

    You can use beforeShowDay to do this

    The following example disables dates 14 March 2013 thru 16 March 2013

    var array = ["2013-03-14","2013-03-15","2013-03-16"]
    
    $('input').datepicker({
        beforeShowDay: function(date){
            var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
            return [ array.indexOf(string) == -1 ]
        }
    });
    

    Demo: Fiddle

提交回复
热议问题