Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI DatePicker - Disable all days except first and 15th day of each month

I want to disable all days on this datepicker except the 1st and 15th of every month. I referenced this answered question, but I am only able to return one date. I'm a novice in javascript. jQuery UI DatePicker - Disable all days except last day of month

Any help would be great, thank you.

like image 380
Chris Avatar asked Aug 21 '12 19:08

Chris


1 Answers

This should do the trick:

$(function(){
    $("input").datepicker(
        {
        beforeShowDay: function (date) {

        if (date.getDate() == 15 || date.getDate() == 1) {
            return [true, ''];
        }
        return [false, ''];
       }
    });
});

​ Check out the link below for a working example!

http://jsfiddle.net/HM83u/

like image 57
gaffleck Avatar answered Oct 03 '22 16:10

gaffleck