我想在文档准备就绪时显示事件。怎么做?以下方法有效但仅在我点击日期时。
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, '', ''];
}
}
});
});