notebook

Some random notes...

понедельник, 26 сентября 2011 г.

jQuery - check minimum version

To check whether jQuery is loaded to the page and verify minimum version:
if (typeof jQuery == 'undefined' || 
   !/[1-9]\.[3-9].[1-9]/.test($.fn.jquery)
) {
    throw('jQuery version 1.3.1 or above is required');
}
The regular expression determines the required jQuery version - /[X-9]\.[Y-9].[Z-9]/.
For example, for 1.3.1 use /[1-9]\.[3-9].[1-9]/, for 1.2.3 use /[1-9]\.[2-9].[3-9]/ etc.

Ярлыки:

Комментарии: 0:

Отправить комментарий

Подпишитесь на каналы Комментарии к сообщению [Atom]

<< Главная страница