15

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.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Andre Meinhold
  • 5,087
  • 3
  • 21
  • 29

2 Answers2

22

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

console.log( jQuery.fn.jquery );

outputs the string "1.8.0" for instance.

jAndy
  • 231,737
  • 57
  • 305
  • 359
5
// Returns string Ex: "1.3.1"
$().jquery;

// Also returns string Ex: "1.3.1"
jQuery.fn.jquery;
James
  • 13,571
  • 6
  • 61
  • 83