Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the jQuery-UI version?

This should be an easy question, but how do I detect the jQuery-UI version?

This is for a Greasemonkey script and the (current) target page appears to be running jQuery-UI, 1.5.2. But, different target pages may run different versions.

console.log ($.ui); did not show anything useful/obvious for version detection.

like image 845
Brock Adams Avatar asked Sep 07 '10 10:09

Brock Adams


People also ask

What is jQuery UI latest version?

jQuery UI 1.13. 0 released | jQuery UI Blog.

How do I check jQuery version?

Type this command in the Chrome Developer Tools Javascript console window to see what version of the jQuery is being used on this page: console. log(jQuery(). jquery);

What is jQuery UI?

jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you're building highly interactive web applications or you just need to add a date picker to a form control, jQuery UI is the perfect choice.


1 Answers

You can use $.ui.version, it's actually the property jQuery UI looks for when determining if it should load itself (if it's already there, abort).

For example here's a fiddle including version 1.8.4.

Unfortunately, $.ui.version was added in jQuery-UI version 1.6.

For earlier versions, you can check for $.ui though.

So, in this case, the following might be good enough:

var version = $.ui ? $.ui.version || "pre 1.6" : 'jQuery-UI not detected'; 
like image 89
Nick Craver Avatar answered Sep 25 '22 19:09

Nick Craver