Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.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
Javascript 在jQuery weekcalendar中将自定义变量设置为calEvent_Javascript_Jquery_Variables_Jquery Plugins_Jquery Week Calendar - Fatal编程技术网

Javascript 在jQuery weekcalendar中将自定义变量设置为calEvent

Javascript 在jQuery weekcalendar中将自定义变量设置为calEvent,javascript,jquery,variables,jquery-plugins,jquery-week-calendar,Javascript,Jquery,Variables,Jquery Plugins,Jquery Week Calendar,我正在使用以显示带有约会的基于web的日历。一些内置函数,如setEventUserId在calEvent中存储一些变量 在calEvent对象中存储自定义变量需要做什么 比如: setEventCategoryId: function(calendarId, calEvent, calendar) { calEvent.calendarId = calendarId; return calEvent; }, getEventCategoryId: function(calEvent,

我正在使用以显示带有约会的基于web的日历。一些内置函数,如
setEventUserId
在calEvent中存储一些变量

在calEvent对象中存储自定义变量需要做什么

比如:

setEventCategoryId: function(calendarId, calEvent, calendar) {
  calEvent.calendarId = calendarId;
  return calEvent;
},
getEventCategoryId: function(calEvent, calendar) {
  return calEvent.calendarId;
}
但是我什么时候调用这个方法呢?仅仅用这段代码来存储变量就足够了吗


非常感谢任何输入。

插件内部存储的变量由插件内部使用。插件没有在内部使用自定义变量,因此使用插件存储它们是没有意义的

您可以使用jQuery的
.data()
函数针对元素存储任意数据

例如,设置:

$(calEvent).data('calendarId', calendarId);
要检索:

var calendarId = $(calEvent).data('calenderId');

您能提供一个JSFIDLE示例吗?