Javascript 检查 jQuery UI 是否已加载

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8052877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 04:31:38  来源:igfitidea点击:

check if jQuery UI is loaded

javascriptjqueryjquery-ui

提问by vsync

Possible Duplicate:
Testing if jQueryUI has loaded

可能的重复:
测试 jQueryUI 是否已加载

How to check if the jQuery UIextension library to jQuery is loaded on the page?

如何检查页面上是否加载了jQuery UI扩展库到 jQuery?

回答by Brad Christie

if (typeof jQuery.ui !== 'undefined') ...

Should work.

应该管用。

See also this SO post.

另请参阅此 SO 帖子

回答by mikeycgto

Can check:

可以检查:

$.ui

Or get the version:

或者获取版本:

$.ui.version

回答by mccow002

Just make sure you put any code that calls it in $(document).ready(). At that point, everything should be loaded on the page.

只要确保将调用它的任何代码放在 $(document).ready() 中。那时,所有内容都应该加载到页面上。