gpt4 book ai didi

javascript - jQuery UI 选择菜单错误

转载 作者:行者123 更新时间:2023-12-03 06:37:18 25 4
gpt4 key购买 nike

我正在尝试实现 jQuery UI SelectMenu,但我在浏览器控制台中一次又一次地出现相同的错误。

这是 HTML 代码

<select name="files" id="files">
<optgroup label="Scripts">
<option value="jquery">jQuery.js</option>
<option value="jqueryui">ui.jQuery.js</option>
</optgroup>
<optgroup label="Other files">
<option value="somefile">Some unknown file</option>
<option value="someotherfile">Some other file with a very long option text</option>
</optgroup>
</select>

和 Javascript/jQuery 代码

$(function() {

$( "#files" ).selectmenu();

});

它与 jQuery UI 网站相同,但对我不起作用。

这是错误:

jquery-3.0.0.js:9779 Uncaught TypeError: elem.getClientRects is not a function

希望大家有想法。

谢谢

最佳答案

jquery 版本 >= 3.0 与较旧的 jquery-ui 或可能是最新版本存在兼容性问题。我建议您包含 jquery-migrate-3.0.js 并看看这是否有效。

根据release doc :

To assist with upgrading, we have a brand new 3.0 Upgrade Guide. And the jQuery Migrate 3.0 plugin will help you to identify compatibility issues in your code. Your feedback on the changes will help us greatly, so please try it out on your existing code and plugins.

In addition, we’ve got the release for jQuery Migrate 3.0. We highly recommend using this to address any issues with breaking changes in jQuery 3.0. You can get those files here:

jquery-migrate-3.0.js

jquery-migrate-3.0.min.js

Fiddle DEMO with jquery migrate 3.0 included

关于javascript - jQuery UI 选择菜单错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38136205/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com