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

  • By
    Hot Effect: MooTools Drag Opacity

    As you should already know, the best visual features of a website are usually held within the most subtle of details. One simple trick that usually makes a big different is the use of opacity and fading. Another awesome MooTools functionality is...

  • By
    JavaScript Canvas Image Conversion

    At last week's Mozilla WebDev Offsite, we all spent half of the last day hacking on our future Mozilla Marketplace app. One mobile app that recently got a lot of attention was Instagram, which sold to Facebook for the bat shit crazy price of one...

Discussion

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