MultiDatesPicker addDisabledDates

2019-02-28 17:49发布

问题:

Error : Uncaught Missing number at position 0

php
$date_disabled = "'03/04/2015','03/10/2015'";

html
<input type="text" id="date" value="<?php echo $date_disabled; ?>" />

javascript
$(document).ready(function(){ 
    $('#booking_date').multiDatesPicker({
      addDisabledDates: [$('#date').val()]
    });
});

Just wondering if able to pull value from html input text to javascript like this? i'm not sure why is this error appearing...

if i set the value manually into the javascript than the multi date picker is running well without any problem.

$(document).ready(function(){
    $('#booking_date').multidatesPicker({
       addDisabledDates:['03/04/2015','03/10/2015']
    });
});

Thousand appreciate to anyone could help. :D

回答1:

Use this Demo here

var array = ["14-03-2015","17-03-2015","16-03-2015"]

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