Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error on firefox: $.widget is not a function

I have a few multiselect boxes from the Jquery UI on a page that work perfectly well in Chrome & Safari but not in Firefox for some reason... when I load the Error Console in Firefox I see:

Error: $.widget is not a function
Source File: http://localhost:3000/javascripts/jquery.multiselect.js?1302660373
 Line: 563

Any ideas why?


edit: the line itself is within the open function right where it says "// react to option changes after initialization"

    // open the menu
open: function(e){
    var self = this,
        button = this.button,
        menu = this.menu,
        speed = this.speed,
        o = this.options;
    widget: function(){
    return this.menu;
},

// react to option changes after initialization
_setOption: function( key, value ){
    var menu = this.menu;

    switch(key){
        case 'header':
            menu.find('div.ui-multiselect-header')[ value ? 'show' : 'hide' ]();
like image 664
mtay Avatar asked Apr 25 '11 06:04

mtay


2 Answers

I am assuming you are using the jQuery Multiselect plugin… which depends on jQuery UI.

Sounds like you have not included enough of the jQuery UI library or just none of it. You need to include the core parts of jQuery UI (including Widget) if you build a custom download. Or just download the whole jQuery UI and include it instead.

like image 196
andyb Avatar answered Sep 21 '22 14:09

andyb


For anyone else who is getting this but has the requirements; make sure you are including the Javascript files in the correct order. This error was being caused by my jquery-ui.js being included after the multiselect js file.

like image 34
Jonathan Thompson Avatar answered Sep 20 '22 14:09

Jonathan Thompson