0

I am using Jquery Ui Datepicker. I want to disable all dates except Wednesday and Sunday Dates. I wrote code like below. But it works only for Wednesday dates. And it displays from next month Onwards.I want it enable current month also.

<script>
$(function() {
$( "#datepicker" ).datepicker({
dateFormat: 'dd-mm-yy',
    minDate: 1,
    beforeShowDay: enableWednesday,

});
});
function enableWednesday(date) {
    var day = date.getDay();
    return [(day == 3), ''];
}

</script>

Please help me to enable all Wednesday and Sunday dates for current month also.Thanks in advance

user2637639
  • 47
  • 1
  • 3
  • 9

2 Answers2

2

Try this code

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

            if (date.getDay() == 0 || date.getDay() == 3) {
                return [true, ''];
            }
            return [false, ''];
           }
        });
    });
Sridhar R
  • 20,190
  • 6
  • 38
  • 35
  • this is duplicate question please refer following url: http://stackoverflow.com/questions/2968414/disable-specific-days-of-the-week-on-jquery-ui-datepicker –  Oct 30 '13 at 09:11
0

Please refer the following url Disable specific days of the week on jQuery UI datepicker

Community
  • 1
  • 1