jQuery datepicker在文档准备就绪时显示事件

时间:2015-04-24 10:11:47

标签: jquery datepicker jquery-ui-datepicker

我想在文档准备就绪时显示事件。怎么做?以下方法有效但仅在我点击日期时。

var Event = function (text, className) {
    this.text = text;
   this.className = className;
};

var events = {};
events[new Date("03/14/2015")] = new Event("Lorem ipsum", "event");

$(document).ready(function () {
        $("#datepicker").datepicker({

            beforeShowDay: function (date)
            {
                var event = events[date];
                if (event) {
                    return [true, event.className, event.text];
                }
                else {
                    return [true, '', ''];
                }
            }
        });
    });

0 个答案:

没有答案