Alexander Nikolov
Alexander Nikolov

Reputation: 1979

How to determine which library uses $ sign from console?

I have handled a project which uses multiple JS libraries, including jQuery. Checked

 $.fn.jquery 

and it returns

Cannot read property 'jquery' of undefined

However,

 jQuery.fn.jquery

returns the jquery version, which tells me that something else is using the $ sign. Is there any way to determine if some library uses it and which one from console ?

Upvotes: 0

Views: 82

Answers (1)

Laxmikant Dange
Laxmikant Dange

Reputation: 7688

All libraries have their own properties and methods, The better way to find is, type $ in chrome console, and try to expand till you get expected result.

jQuery has fn object which has jquery property which holds version of jQuery.

Lets say there is another library which uses $, that might has property version to get version.

The better way to use jQuery is using closure.

Here is Example.

(function($){//Here you can use $ or $$ or anything which is allowed to use as variable.

})(jQuery);

Upvotes: 1

Related Questions