Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know jQuery version programmatically [duplicate]

Possible Duplicate:
Get jQuery version from inspecting the jQuery object

Pretty much that..

I don't know which jQuery version gets loaded every time, so I want to be able to react differently for different versions.

like image 888
Andre Meinhold Avatar asked Aug 10 '12 13:08

Andre Meinhold


2 Answers

// Returns string Ex: "1.3.1"
$().jquery;

// Also returns string Ex: "1.3.1"
jQuery.fn.jquery;
like image 39
James Avatar answered Sep 19 '22 12:09

James


jQuery exposes its version on the prototype (.fn):

console.log( jQuery.fn.jquery );

outputs the string "1.8.0" for instance.

like image 132
jAndy Avatar answered Sep 19 '22 12:09

jAndy