Pavan Ghantasala
Pavan Ghantasala

Reputation: 249

Jquery version check

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.

Upvotes: 7

Views: 27698

Answers (4)

Bhargav Variya
Bhargav Variya

Reputation: 775

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

It's work for me, try it

Upvotes: 0

Burhan Maseel
Burhan Maseel

Reputation: 31

Use this line of code in console of chrome dev tools

$.fn.jquery

This provides version of jQuery as a string

Upvotes: 0

Chanaka Weerasinghe
Chanaka Weerasinghe

Reputation: 5742

$().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

Upvotes: 2

Chandan Kumar
Chandan Kumar

Reputation: 909

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)

Upvotes: 5

Related Questions