Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Datepicker: restrict date selection based on week day

Is it possible to make modify jQuery UI Datepicker to only allow users to select, for example, Mondays?

like image 785
JamesJameson Avatar asked Apr 18 '11 19:04

JamesJameson


1 Answers

Here you go: Mondays are not selectable:

$(document).ready(function(){
    $('input').datepicker({beforeShowDay: function(date){
        return [date.getDay() != 1, ''];
    }});
});

Functioning example you can play with here: http://jsfiddle.net/RaYZ5/19/.

API documentation: http://docs.jquery.com/UI/Datepicker#event-beforeShowDay

like image 114
Milimetric Avatar answered Oct 05 '22 08:10

Milimetric