• I want to use a jQuery plugin (not a WP plugin) but the JS in the plugin uses the default ‘$’ rather than WP’s ‘jQuery’ to identify itself. In order to make this work with WP, do I need to change the code in the plugin or is there a hook/filter I can invoke to correct this?

    Thanks.

    clarification: installing, linking to the jQuery plugin is not the issue.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    As long as you don’t load or need prototype, jQuery’s load should take the $ symbol and that’s what it’ll be linked to. WordPress doesn’t call jQuery.noConflict() anywhere, I think.

    Apparently, I am using jQuery() instead of $() as I think WordPress uses jQuery(). Open up wp-includes/js/thickbox/thickbox.js and you will see that it is using jQuery() instead of $(). The default thickbox comes with $().

    Thread Starter Glenn Ansley

    (@blepoxp)

    I was using jQuery rather than $ because that’s the only way I could get it to work in my WP Plugin functions. Strangely enough though, the jQuery plugin I am using right now is working okay with the $ rather than the jQuery notation.

    I guess I’ll be okay if I don’t use prototype, I just can’t figure why

    $(document).ready(function(){
      blah blah blah
    });

    won’t work in my plugin’s function but

    jQuery(document).ready(function(){
      blah blah blah
    });

    does work.

    I just faced exactly the same issue. $ function calls within WP return an error in my Firebug. When I include another jQuery.js file, it returns an error aswell:

    jQuery(“#media-buttons a”).tTips is not a function
    https://www.domain.de/folder/wp-admin/js/common.js?ver=20080318
    Line 45

    So, do plugin authors have to modify jQuery plugins for using with WP?

    Odd.

    To avoid conflicts (which can crop up when users install other plugins), you’ll probably need to change the $ references.

    See this post: JQuery and jQueryUI

    PS

    The author of the JQuery Validation plugin, J?rn Zaefferer, pointed out on the Google jQuery forum the correct format that you should typically see in a jQuery plugin (ie js file)

    https://docs.jquery.com/Plugins/Authoring#Custom_Alias_in_plugin_code

    He also said if jQuery authors don’t use this format and it causes problems, it’s a bug in the JavaScript file and should be reported as such.

    I encountered same error as Alphawolf.

    jQuery("#media-buttons a").tTips is not a function
    https://localhost/blog/wp-admin/js/common.js?ver=20080318
    Line 45

    Surprisingly I am using jQuery everywhere, instead of my $ in my code.
    In face I tried removing all code from my js file but no use.

    I think common.js throws error before custom js file can be reached.

    Now possible solution could be to figure out why common.js is throwing error and fix it.

    Please help me/correct me if I am wrong.

    @rahul286 and Alphawolf… I don’t really know if this is a bug, or even an important discrepancy… plus, I haven’t seen this error on my sites. In fact, when I go to an edit page and hover over the media buttons the tip pops up just fine with no complaints from FireBug; still, this issue may only manifest when certain other JavaScript libraries or plugins are loaded… or when someone’s plugin is attempting to call the tTips function for its own purpose.

    The code in common.js which defines the tTips function doesn’t precisely match the recommended aliasing method in the link I posted above.

    common.js line 43:

    }(jQuery));

    the recommended aliasing method from the jQuery team:

    })(jQuery);

    Try moving the “)” and see if that corrects the issue (without breaking anything, of course). If so, please post something here… and if you can, file a WordPress bug report.

    I’m having an issue getting a jquery plugin to work.
    I have tried replacing the $ with jquery in all the javascript files without any luck.

    Here is the page I’m trying to get working…
    https://www.line47.com/discography/

    any help would be greatly appreciated.
    Thanks!
    Scott

    it’s making it though all the scripts but the last it’s getting stalled on

    $panels is null on line 13 of slider.js…
    any ideas?

    Could be a spelling mistake of yours, but you have to use jQuery, not jquery.

    ps. Nice beard, dude. ??

    Thanx to this forum,I have solved my problem over here. ??

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Resolving jQuery Conflicts in jQuery Plugins’ is closed to new replies.