Change Datepicker
smoke_detector_testing_application.php
Does anyone have any advice on how to change the datepicker so that the user can only select Tuesdays? Thanks
smoke_detector_testing_application.php
Does anyone have any advice on how to change the datepicker so that the user can only select Tuesdays? Thanks
The function you need is beforeShowDay
here is an example which should work for you.
$('#datepicker_1').datepicker({
beforeShowDay: nonWorkingDates,
dateFormat: 'dd/mm/yy',
showAnim: 'show',
onClose: closeDatePicker_datepicker_1
});
function nonWorkingDates(date){
var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
var closedDays = [[Sunday],[Monday],[Wednesday],[Thursday],[Friday],[Saturday]];
for (var i = 0; i < closedDays.length; i++) {
if (day == closedDays[i][0]) {
return [false];
}
}
return [true];
}
code you need is in red.
For other days to exclude, such as national holidays, take a look at the original thread..
can-the-jquery-ui-datepicker-be-made-to-disable-saturdays-and-sundays-and-holid
WOW nice one. Thanks. Can I buy you a beer lol Will this site let me know how to omit the previous Tuesday that has gone buy already? Thanks again as it worked great!
actually, yes, (on both q's).
if you google the function name, you will probably find a code snippet to do that for you too
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.