jQuery Version Verifier
The following is a little snipplet to check if the current JQuery version installed is at leas whatever you need...
example: isJQueryVersionAtLeast(1,2,3)
I wrote this down because i found that the usual way of doing it through REG EXPs fails on mayor versions.
function isJQueryVersionAtLeast(mayor, minor, fix){
var minVersion = [mayor,minor, fix];
var currVersion = $.map($.fn.jquery.split('.'), function(item, index){
return parseInt(item);
});
return currVersion[0] > minVersion[0] ||
(currVersion[0] == minVersion[0] &&
(currVersion[1] > minVersion[1] ||
(currVersion[1] == minVersion[1] &&
currVersion[2] >= minVersion[2])));
}
Written by Octavio Luna
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#