Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui JQuery DatePicker默认为下一个可用日期_Jquery Ui - Fatal编程技术网

Jquery ui JQuery DatePicker默认为下一个可用日期

Jquery ui JQuery DatePicker默认为下一个可用日期,jquery-ui,Jquery Ui,我的日历只允许选择周二和周四。 我希望输入字段中的默认日期是下一个可用日期。例如,如果我在星期三打开页面,我希望星期四的日期由defautl输入。 现在我有“今天的日期”。如何更改代码以选择下一个可用日期 $(function() { $( "#datepicker" ).datepicker({ showOn: "button", buttonImage: "/b/i/Calendar.gif", buttonImageOnly: true, numberOfM

我的日历只允许选择周二和周四。 我希望输入字段中的默认日期是下一个可用日期。例如,如果我在星期三打开页面,我希望星期四的日期由defautl输入。 现在我有“今天的日期”。如何更改代码以选择下一个可用日期

$(function() {
$( "#datepicker" ).datepicker({
    showOn: "button",
    buttonImage: "/b/i/Calendar.gif",
    buttonImageOnly: true,
    numberOfMonths: 2,
    minDate: 0,
    showButtonPanel: true,
    beforeShowDay: function(date)
    { return [(date.getDay() == 2 || date.getDay() == 4), ""]; } //Tuesdays and Thursdays
});
if($("#datepicker").datepicker("getDate") === null) {
    //select today's date
    var myDate = new Date();
            var month = myDate.getMonth() + 1;
            var todayDate = month + '/' + myDate.getDate() + '/' + myDate.getFullYear();
            $("#datepicker").val(todayDate);
}
});

提前谢谢

我来到这里是为了下周二/周四得到这段代码。
一定有更聪明的方法,但它是有效的:o)

代码如下:

var $datePicker = $("#datepicker");

if ($datePicker.datepicker("getDate") === null) {

    var today = new Date(),
        todayDay = today.getDay(),
        day = ((todayDay >= 2 && todayDay < 4 )
                   ? 4
                   : (todayDay >= 4 && todayDay <= 6)
                        ? 9
                        : 2) - todayDay,
        nextDay = new Date(today.setDate(today.getDate() + day));

    $datePicker.val((nextDay.getMonth() + 1) + '/' + nextDay.getDate() + '/' + nextDay.getFullYear());

}
var$datePicker=$(“#datePicker”);
if($datePicker.datePicker(“getDate”)==null){
var today=新日期(),
todayDay=今天。getDay(),
天=((今天>=2和&今天<4)
4.

:(todayDay>=4&&todayDay我来这段代码是为了下周二/周四。
一定有更聪明的方法,但它是有效的:o)

代码如下:

var $datePicker = $("#datepicker");

if ($datePicker.datepicker("getDate") === null) {

    var today = new Date(),
        todayDay = today.getDay(),
        day = ((todayDay >= 2 && todayDay < 4 )
                   ? 4
                   : (todayDay >= 4 && todayDay <= 6)
                        ? 9
                        : 2) - todayDay,
        nextDay = new Date(today.setDate(today.getDate() + day));

    $datePicker.val((nextDay.getMonth() + 1) + '/' + nextDay.getDate() + '/' + nextDay.getFullYear());

}
var$datePicker=$(“#datePicker”);
if($datePicker.datePicker(“getDate”)==null){
var today=新日期(),
todayDay=今天。getDay(),
天=((今天>=2和&今天<4)
4.
:(今天你是最棒的:)非常感谢你你是最棒的:)非常感谢