Jacques
Jacques

Reputation: 7135

jquery ui button() is not a function

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?

Upvotes: 3

Views: 8406

Answers (1)

Sriharsha
Sriharsha

Reputation: 111

Faced a similar problem today. In my case, the jQuery ui filename didn't match. The file was named as

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

And the file was referred to as

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

jQuery fails silently and I had to waste 3hrs finding the mistake.

Edit

Upon further investigation. Now I found another mistake. I previously used 'custom download' option to download the bundle. In that build different widgets were not automatically included in the jqueryui.custom.js file. So none of the widgets were available for use.

Upvotes: 5

Related Questions