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

  • By
    Welcome to My New Office

    My first professional web development was at a small print shop where I sat in a windowless cubical all day. I suffered that boxed in environment for almost five years before I was able to find a remote job where I worked from home. The first...

  • By
    Create Namespaced Classes with MooTools

    MooTools has always gotten a bit of grief for not inherently using and standardizing namespaced-based JavaScript classes like the Dojo Toolkit does.  Many developers create their classes as globals which is generally frowned up.  I mostly disagree with that stance, but each to their own.  In any event...

Incredible Demos

Discussion

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