:
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;
}
, :
var blnIsNewJQuery = checkVersion($.fn.jquery,"1.8.3")>0?true:false;
You should also keep track of versions beyond 9.99.99. The code also extends for templates such as 11/11/11. It is also worth checking if the values of the valid-integer array are valid. You can go further to check also such notations as: 11.11.11.RC1
Hope this helps, sorry for my english
source
share