What is secure way to use jquery no conflict

i am developing wordpress plugin , plugin needs jquery , the problem is when I tried to use jQuery keyword it works if wordpress use no conflicts, if no conflict is not added by theme builder I mean in older wordpress theme they used the keyword like $

Problem :

1. How to detect the jquery no conflict triggered or not ?

2. Or need that dom ready function which is will work for both no.Conflict jQuery and $

Thank You.


jQuery's no conflict mode is intended to resolve disputes between multiple frameworks (or instances of jQuery) that all want to use the $ shortcut. There shouldn't ever be a case, regardless of whether or not jQuery.noConflict() has been called, where $ refers to jQuery and jQuery doesn't also refer to (a version of) jQuery.

If you want to use $ to refer to jQuery, regardless of no conflict status, then you can do something like this:

(function($) {
    // code that uses jQuery here

That's an immediately invoked function expression which has a parameter named $ which is passed the jQuery variable. It creates a closure inside of which you can be guaranteed that $ refers to jQuery, it's the standard way that jQuery plugins are written if they want to be able to use the $ shortcut.

If you're always using a DOM ready handler, and all of your code using jQuery is inside of the function passed to it, it has a similar mechanism for doing that since the DOM ready handler always passes the instance of jQuery to that function:

jQuery(function($) {
    // $ definitely refers to jQuery here

// $ may or may not refer to jQuery here

Need Your Help

Request Sets, request groups, concurrent programs... what is the relationship between all these?

oracle business-intelligence bi-publisher

Hi Oracle XML Publisher, I'm looking for a high-level picture of how things work. It's not clicking for some reason.

Get facebook likes count of multiple pages

facebook facebook-graph-api facebook-like

I am about to create a facebook page for a photo contest.