agente_secreto
agente_secreto

Reputation: 8079

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 only important info here is: remember to use jQuery, and not $, when writing jQuery for the WP admin panel

Upvotes: 0

Views: 868

Answers (1)

Stephen
Stephen

Reputation: 18964

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.

Upvotes: 2

Related Questions