Skip to content

Instantly share code, notes, and snippets.

@Eclarian
Created December 14, 2011 20:33
Show Gist options
  • Save Eclarian/1478375 to your computer and use it in GitHub Desktop.
Save Eclarian/1478375 to your computer and use it in GitHub Desktop.
jQuery Version Function
/**
* jQuery Version returned as 3 digit integer
*
* Allows you to perform version ranges if ( jQueryVersion() < 170 )
* Useful for plugin dev with events and dealing with live, delegate, and on
*
* @author Eclarian LLC
* @return integer
*/
var jQueryVersion = function() {
var jQueryVersion = $.fn.jquery;
jQueryVersion = jQueryVersion ? jQueryVersion.split('.'): [];
// Since some versions do not include the third point (why NOT?!)
while ( jQueryVersion.length < 3 ) {
jQueryVersion.push(0);
}
return parseInt(jQueryVersion.join(""));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment