Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 520
Jacques Avatar asked Jun 28 '26 19:06

Jacques


1 Answers

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.

like image 151
Sriharsha Avatar answered Jul 01 '26 10:07

Sriharsha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!