You probably aren't going to be able to modify datepicker to do this (I will gladly concede to anyone proving otherwise), but you can easily add dates to a standard select control.
In this code, I have used the formatDate from the datepicker UI, so you'll need to include jQuery UI, or at least the datepicker component, for it to work.
The following example adds 10 days, starting with the current day to a select element with an ID of "mySelect".
$(function () {
var today = new Date();
var date = new Date();
for (x = 0; x <= 9; x++) {
date.setDate(today.getDate() + x);
textDate = $.datepicker.formatDate('D, dd-M', date);
$('#mySelect')
.append($("<option></option>")
.attr("value", textDate)
.text(textDate));
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.