I use this snipped:
/**
* Checks if versionA is bigger, lower or equal versionB
* It checks only pattern like 1.8.2 or 1.11.0
* Major version, Minor version, patch release
* @param strVersionA a version to compare
* @param strVersionB the other version to compare
* @returns {*} 1 if versionA is bigger than versionB, -1 if versionA is lower than versionB and 0 if both versions are equal
* false if nothing worked
*/
function checkVersion(strVersionA, strVersionB){
var arrVersionA = strVersionA.split('.');
var arrVersionB = strVersionB.split('.');
var intVersionA = (100000000 * parseInt(arrVersionA[0])) + (1000000 * parseInt(arrVersionA[1])) + (10000 * parseInt(arrVersionA[2]));
var intVersionB = (100000000 * parseInt(arrVersionB[0])) + (1000000 * parseInt(arrVersionB[1])) + (10000 * parseInt(arrVersionB[2]));
if (intVersionA > intVersionB) {
return 1;
}else if(intVersionA < intVersionB){
return -1;
}else{
return 0;
}
return false;
}
So you can use it like this:
var blnIsNewJQuery = checkVersion($.fn.jquery,"1.8.3")>0?true:false;
You have to keep also an eye on versions beyond 9.99.99. The code is also expandable for patterns like 11.11.11.11.
It will be also worth a tought to check if the array-values are valid-integer. You can go further to check also for notations like: 11.11.11.RC1
Hope it helps, sorry for my english