且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

带时隙的jQuery日历选择

更新时间:2023-02-26 20:43:26

请检查这个
http://jsfiddle.net/Xx4GS/258/

这个想法是关于更改我们正在创建新的html元素并附加到datepicker。您需要根据需要修改设计。在change事件中调用ajax函数以从DB获取时隙。因为我可以看到你提供的链接也是这样做的。

The idea is on change we are creating the new html element and appending to the datepicker. You need to modify the design according to your need. Call the ajax function in the change event to fetch the time slot from DB. because I can see that the link you gave is also doing the same.

附加代码:

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

var $datePicker = $("div");

$datePicker.datepicker({
    changeMonth: true,
    changeYear: true,
    inline: true,
    altField: "#datep",
}).change(function(e){
    setTimeout(function(){   
        $datePicker
            .find('.ui-datepicker-current-day')
            .parent()
            .after('<tr>\n\
                        <td colspan="8">\n\
                            <div> \n\
                                <button>8:00 am – 9:00 am </button>\n\
                            </div>\n\
                            <button>9:00 am – 10:00 am</button>\n\
                            </div>\n\
                            <button>10:00 am – 11:00 am</button>\n\
                            </div>\n\
                        </td>\n\
                   </tr>');

    });
});
<div id="datepicker"></div>