views:

92

answers:

2

I am new with javascript still, but I would like to know how to check if a library is supposed to be using $ and then do an if statement off of it. Sorry if I have a hard time asking this!

+7  A: 

You can test if two object are the same with the === operator:

if ( $ === jQuery ) {
  // $ is a reference to jQuery
}
Borgar
$ === window.jQuery would work better in case jQuery isn't being used.
Joe Chung
+1  A: 

Another way to tell if it is jQuery

if($(document.body).jquery){alert("yep");}
epascarello