Get the jQuery Version

By  on  

Many JavaScript frameworks provide a version property on their main object, providing a quick bit of important information about the framework.  The main jQuery object doesn't provide this property, however, so developers need to do a bit more work to get that version information.  Here's how to get the jQuery version number for a given jQuery script!

The jQuery JavaScript

The jQuery version lives within jQuery.fn:

var v = jQuery.fn.jquery;

/*
You may also use:

var v = jQuery().jquery; // "1.4.2"
*/

The jquery property of the jQuery.fn object provides the version number as a string.  Not as easy as .version access, but provides the jQuery version nonetheless!

Recent Features

Incredible Demos

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!