开发者

Problem with jQuery noConflict in Wordpress backend

I am using the fullcalendar plugin, and want to call it from the Wordpress backend. The problem is that apparently, Wordpress uses noConflict in its backend, so jQuery is not extended with the fullcalendar plugin.

I've tried to call the plugin with both jQuery("#calendar").fullCalendar and $("#calendar").fullCalendar, and neither of them work.

The error I get in firebug is: jQuery("#calendar").fullCalendar is not a function

I think that what i need to do is modify the plugin file so it applies the new fullCalendar function to jQuery, not to $, but I cant't figure out how.

This is the plugin in question: http://pastebin.com/tTahfj9b

EDIT: I dont know why it wasnt working before, but now I can call the method with jQuery(selector).fullCalendar.

The o开发者_运维知识库nly important info here is: remember to use jQuery, and not $, when writing jQuery for the WP admin panel


Without looking at the plugin, it sounds like it needs a little help. You'll need to edit the plugin to make it more "nice."

Do this in the plugin file:

(function($) {

    // fullcalendar plugin

}(jQuery));

This will scope the jQuery object to the $ variable around the plugin.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜