Get jQuery version from inspecting the jQuery object

JavascriptJquery

Javascript Problem Overview


Is there a way to find out what version of jQuery is being used by inspecting the jQuery object? jQuery is dynamically getting added to my page and I cannot see any reference to it in my markup. If I inspect it in my browser's console, it's there.

Javascript Solutions


Solution 1 - Javascript

You can use either $().jquery; or $.fn.jquery which will return a string containing the version number, e.g. 1.6.2.

Solution 2 - Javascript

FYI, for the cases where your page is loading with other javascript libraries like mootools that are conflicting with the $ symbol, you can use jQuery instead.

For instance, jQuery.fn.jquery or jQuery().jquery would work just fine:

screen shot for checking jQuery version

Solution 3 - Javascript

$().jquery will give you its version as a string.

Solution 4 - Javascript

$()['jquery']

Invoke console.log($()) and take note about jquery object fields :

  • jquery
  • selector
  • prevObject

enter image description here

Solution 5 - Javascript

For older versions of jQuery

jQuery().jquery  (or)

jQuery().fn.jquery

For newer versions of jQuery

$().jquery  (or)

$().fn.jquery

Solution 6 - Javascript

You can get the version of the jquery by simply printing object.jquery, the object can be any object created by you using $.

For example: if you have created a <div> element as following

var divObj = $("div");

then by printing divObj.jquery will show you the version like 1.7.1

Basically divObj inherits all the property of $() or jQuery() i.e if you try to print jQuery.fn.jquery will also print the same version like 1.7.1

Solution 7 - Javascript

console.log( 'You are running jQuery version: ' + $.fn.jquery );

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJeffView Question on Stackoverflow
Solution 1 - JavascriptDavid HancockView Answer on Stackoverflow
Solution 2 - JavascriptDevyView Answer on Stackoverflow
Solution 3 - JavascriptShankarSangoliView Answer on Stackoverflow
Solution 4 - JavascriptAbdennour TOUMIView Answer on Stackoverflow
Solution 5 - JavascriptMahendra JellaView Answer on Stackoverflow
Solution 6 - JavascriptArun KumarView Answer on Stackoverflow
Solution 7 - JavascriptLakshmana Kumar DView Answer on Stackoverflow