编写一个简单的日历脚本,尝试将事件发布到正确的日期;但是 jQuery$.extend
并没有扩展我的options
对象。以下是 HTML 文件的片段:
$("#cal").calendar({
month: 2,
events: [{
date: "2013-4-10",
workorder: 1234567890,
district: 01,
range: "2:00pm - 4:00pm",
appNotes: "This is just a sample of some notes... end",
installer: "John Doe",
cityNotes: "This is just another sample of some notes... end"
}, {
date: "2013-4-1",
workorder: 1234567890,
district: 01,
range: "3:00pm - 5:00pm",
appNotes: "This is just a sample of some notes... end",
installer: "John Doe",
cityNotes: "This is just another sample of some notes... end"
}]
});
我的插件的开头:
(function($){
$.fn.calendar = function(options){
var defaults= {
month: null,
prev: "prevMonth",
curr: "currMonth",
next: "nextMonth",
events: []
}, options = $.extend(defaults, options);
return($(this).each(function(){
var obj = $(this),
// Etc...
我能够访问对象的属性,但是它并没有像想象的那样被扩展。有任何想法吗?