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 に答える