6

I am trying to check the jquery version check. Tried the following commands in the console:

  1. jQuery. fn. jquery
  2. jQuery(). jquery

but both are printing as "jquery" instead of version number. Please help me on this. The question might be a duplicate but none of them worked for me. so posting again.

Pavan Ghantasala
  • 209
  • 1
  • 4
  • 13
  • 2
    `jQuery.fn.jquery` works fine for me. – Felix Kling Apr 17 '19 at 07:33
  • 1
    Possible duplicate of [How to check what version of jQuery is loaded?](https://stackoverflow.com/questions/6973941/how-to-check-what-version-of-jquery-is-loaded) – Yevhen Horbunkov Apr 17 '19 at 07:37
  • None of them worked for you, so you must be doing something different, eg not including jquery correctly. You'll need to provide a [mcve] that demonstrates *your* problem, as the question, as it stands, has a very straightforward answer, so we need to know what's different about your scenario. – freedomn-m Apr 17 '19 at 08:02
  • `javascript:(()=>alert(window.jQuery&&jQuery.fn.jquery))()` – PM 2Ring Mar 04 '22 at 13:36

4 Answers4

4

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

or

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

or

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

Chandan Kumar
  • 799
  • 7
  • 23
2

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

Link source

sourse 2

For older versions of jQuery

jQuery().jquery  
jQuery().fn.jquery

For newer versions of jQuery

$().jquery
$().fn.jquery
Chanaka Weerasinghe
  • 5,404
  • 2
  • 26
  • 39
0

Use this line of code in console of chrome dev tools

$.fn.jquery

This provides version of jQuery as a string

0
if (typeof jQuery != 'undefined') {  
    // jQuery is loaded => print the version
    alert(jQuery.fn.jquery);
}

It's work for me, try it

Bhargav Variya
  • 725
  • 1
  • 10
  • 18