javascript JQuery UI 选择菜单不是一个函数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24554634/
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-10-28 03:01:44  来源:igfitidea点击:

JQuery UI selectmenu not a function

javascriptjqueryhtmljquery-uijquery-ui-selectmenu

提问by Vance T

I'm trying to style an HTML select menu with JQuery UI; but it simply isn't working. Here is a JSFiddle. Below are stripped down examples of what I'm trying to accomplish.

我正在尝试使用 JQuery UI 设置 HTML 选择菜单的样式;但它根本不起作用。这是一个JSFiddle。下面是我试图完成的精简示例。

Here's my HTML code:

这是我的 HTML 代码:

<form action="#">
    <fieldset>
        <label for="parameterSelectMenu">Select a Parameter</label>
        <select name="parameterSelectMenu" id="parameterSelectMenu">
            <option value="volvo">Temperature Actual</option>
        </select>
    </fieldset>
</form>
<!-- A button to show JQuery is working... -->
<button id="clicker">A button element</button>

Here's the JavaScript:

这是 JavaScript:

$("#clicker").button();
$("#parameterSelectMenu").selectmenu();

In Firefox "selectmenu" is reported as not a function...

在 Firefox 中,“selectmenu”被报告为不是一个功能......

回答by Rahul Gupta

Updated FIDDLEThe problem is that you are using older version of jquery-uiin jsfiddle demo you have created which does not have support for the selectmenu plugin.

更新的FIDDLE问题是jquery-ui您在创建的 jsfiddle 演示中使用了旧版本,该演示不支持selectmenu plugin.

so you have to add the latest version plugin files as shown below:

所以你必须添加最新版本的插件文件,如下所示:

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>