3

In the head section of my mvc application I have references to JQuery and JQuery UI like this:

<script src="/MyPortal/Scripts/modernizr-2.6.2.js">
<script src="/MyPortal/Scripts/jquery-1.8.2.js">
<script src="/MyPortal/Scripts/jquery-ui-1.8.24.js">
etc. 

Then I tried simple jQuery UI widgets such as button and buttonset as follows:

$("#viewSwitch").buttonset();

or

$("#myButton").button();

Firebug always reports:

TypeError: $(...).buttonset is not a function

I've double and triple checked in Firebug the script files are loading correctly. jQuery there's no problems.

In Firebug's command window, after the page has finished loading with no errors, I type in:

jQuery.ui

and it comes back as undefined.

Not sure what's left to check or troubleshoot?

4

1 回答 1

4

今天遇到了类似的问题。就我而言,jQuery ui 文件名不匹配。该文件被命名为

jqueryui/js/jquery-ui-1.10.4.min.js

该文件被称为

jqueryui/js/jquery-ui-1.10.4.custom.min.js

jQuery 默默地失败了,我不得不浪费 3 个小时来寻找错误。

编辑

经进一步调查。现在我发现了另一个错误。我以前使用“自定义下载”选项来下载捆绑包。在该构建中,不同的小部件不会自动包含在 jqueryui.custom.js 文件中。因此,没有任何小部件可供使用。

于 2014-06-12T10:35:27.913 回答