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
  • 34,719
  • 24
  • 185
  • 251
Andre Meinhold
  • 4,847
  • 3
  • 19
  • 28

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
  • 223,102
  • 54
  • 301
  • 354
5
// Returns string Ex: "1.3.1"
$().jquery;

// Also returns string Ex: "1.3.1"
jQuery.fn.jquery;
James
  • 12,807
  • 5
  • 57
  • 81