Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
97
rated 0 times [  104] [ 7]  / answers: 1 / hits: 17393  / 12 Years ago, tue, august 21, 2012, 12:00:00

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.


More From » jquery

 Answers
197

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/


[#83498] Monday, August 20, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rohan

Total Points: 403
Total Questions: 93
Total Answers: 105

Location: Trinidad and Tobago
Member since Mon, Jul 13, 2020
4 Years ago
rohan questions
Tue, Sep 8, 20, 00:00, 4 Years ago
Fri, Aug 21, 20, 00:00, 4 Years ago
Mon, Aug 3, 20, 00:00, 4 Years ago
Thu, Jul 2, 20, 00:00, 4 Years ago
;