How do I get the jQuery-UI version?

后端 未结 1 1654
無奈伤痛
無奈伤痛 2021-01-31 13:37

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-

相关标签:
1条回答
  • 2021-01-31 14:14

    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';
    
    0 讨论(0)
提交回复
热议问题