1. Error description
demo.js:214 uncaught TypeError: $ (...). Customfileinput is isn't a function at
htmldocument.<anonymous> (demo.js:214) at
F (jquery-1.9.0.min.js:1) At
Object.firewith [as Resolvewith] (jquery-1.9.0.min.js:1) at
function.ready (jquery-1.9.0.min.js:1)
At Htmldocument.xt (jquery-1.9.0.min.js:1)
(anonymous) @ demo.js:214
F @ Jquery-1.9.0.min.js:1
firewith @ jquery-1.9.0.min.js:1
ready @ Jquery-1.9.0.min.js:1
xt @ jquery-1.9.0.min.js:1
2. Cause of Error
$ (function () {//####### Buttons $ (' Button,.button, #sampleButton '). button ();
Buttonset $ (' #radioset '). Buttonset ();
$ ("#format"). Buttonset ();
####### Toolbar $ ("#play, #shuffle"). button ();
$ ("#repeat"). Buttonset ();
####### Accordion $ ("#menu-collapse"). Accordion ({header: "H3"});
Dialog Link $ (' #dialog_link '). Click (function () {$ (' #dialog_simple '). Dialog (' open ');
return false;
});
Modal Link $ (' #modal_link '). Click (function () {$ (' #dialog-message '). Dialog (' Open ');
return false;
});
Hover states on the static widgets $ (' #dialog_link, #modal_link, Ul#icons Li '). Hover (function () {
$ (this). addclass (' Ui-state-hover ');
}, Function () {$ (this). Removeclass (' Ui-state-hover ');
}
);
Dialog Simple $ (' #dialog_simple '). Dialog ({autoopen:false, width:600, buttons: { "OK": function () {$ (this). dialog ("Close");
}, "Cancel": function () {$ (this). dialog ("Close");
}
}
});
####### Dialogs $ ("#dialog-message"). Dialog ({autoopen:false, modal:true, buttons: {
Ok:function () {$ (this). dialog ("Close");
}
}
});
Remove focus from Buttons $ ('. Ui-dialog:button '). blur ();
####### Tabs $ (' #tabs2, #tabs, #tabs3 '). Tabs (); Dynamic tabs var tabtitle = $ ("#tab_title"), Tabcontent = $ ("#tab_content"), tabtemplate = "< ; Li><a href= ' #{href} ' >#{label}</a> <span class= ' Ui-icon ui-icon-close ' >remove tab</span>
</li> ", Tabcounter = 2;
var tabs = $ ("#tabs2"). tabs (); Modal dialog Init:custom buttons and a "close" callback reseting the form inside var dialog = $ ("#dialog2"). Dial
OG ({ Autoopen:false, Modal:true, buttons: {add:function () {addTab ();
$ (This). dialog ("Close");
}, Cancel:function () {$ (this). dialog ("Close");
}}, Close:function () {form[0].reset ();
}
}); AddTab form:calls AddTab function on Submit and closes the dialog var form = dialog.find ("form"). Submit (function (event)
{AddTab ();
Dialog.dialog ("close");
Event.preventdefault ();
}); Actual AddTab function:adds new tab using the input from the form above function AddTab () {var label = Ta Btitle.val () | | "tab" + tabcounter, id = "tabs-" + tabcounter, Li = $ (tabtemplate.replace (/#\{href\}/g, "#" + I d). Replace (/#\{label\}/g, label)), tabcontenthtml = Tabcontent.val () | |
"tab" + Tabcounter + "content."; Tabs.find (". ui-tAbs-nav "). Append (LI);
Tabs.append ("<div id=" + ID + "' ><p>" + tabcontenthtml + "</p></div>");
Tabs.tabs ("Refresh");
tabcounter++;
}//AddTab Button:just opens the dialog $ ("#add_tab"). button (). Click (function () {
Dialog.dialog ("open");
}); Close icon:removing the tab on click $ ("#tabs2"). On ("Click", ' Span.ui-icon-close ', function () {var pan
ElId = $ (this). Closest ("Li"). Remove (). attr ("Aria-controls");
$ ("#" + panelid). Remove ();
Tabs.tabs ("Refresh");
}); Combination examples (tabs) and Open dialog $ (' #sampleButton '). On (' click ', Function (event) {Event.preventdef
Ault (); $ (' #dialog_simple '). Dialog ({autoopen:true, modal:true, width:600, Butt
ONS: {"Save": Function () {$ (this). dialog ("Close");
}, "Cancel": Function () {$ (this). dialog ("Close");
}
}
});
});
####### Datepicker $ (' #datepicker '). Datepicker ({inline:true}); ####### slider//Horizontal slider $ (' #h-slider '). Slider ({range:true, values: [17, 67]}
);
Vertical Slider $ ("#v-slider"). Slider ({orientation: "Vertical", Range: "Min", min:0,
max:100, Value:60, Slide:function (event, UI) {$ ("#amount"). Val (Ui.value);
}
});
$ ("#amount"). Val ($ ("#v-slider"). Slider ("value")); Autocomplete var availabletags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C + +", "Clojure", "COBOL", "C Oldfusion "," Erlang "," Fortran "," Groovy "," Haskell "," Java "," JavaScript "," Lisp "," Perl "," PHP "," Python "," Ruby "," Scal
A "," Scheme ");
$ ("#tags"). AutoComplete ({source:availabletags}); ####### Menu $ ("#menu"). menu ();
####### Spinner var Spinner = $ ("#spinner"). Spinner (); $ ("#disable"). Click (function () {if (Spinner.spinner ("option", "Disabled")) {Spinner.spinner ("
Enable ");
} else {Spinner.spinner ("Disable");
}
});
$ ("#destroy"). Click (function () {if (Spinner.data ("Ui-spinner")) {Spinner.spinner ("destroy");
} else {Spinner.spinner ();
}
});
$ ("#getvalue"). Click (function () {Alert (Spinner.spinner ("value"));
});
$ ("#setvalue"). Click (function () {Spinner.spinner ("value", 5);
});
####### tooltip $ ("#tooltip"). ToolTip (); File input (using http://filamentgroup.com/lab/jquery_custom_file_input_book_designing_with_progressive_
enhancement/) $ (' #file '). Customfileinput ({button_position: ' right '}); ####### Wijmo $ ("#menu1"). Wijmenu ({Trigger: ". Wijmo-wijmenu-item", Triggerevent: "click"}); Select a Date Range with DatePicker $ ("#rangeBa"). DatePicker ({defaultdate: "+1w", changemonth:t Rue, Numberofmonths:3, Onclose:function (selectedDate) {$ ("#rangeBb"). DatePicker ("Optio
N "," MinDate ", selectedDate);
}
}); $ ("#rangeBb"). DatePicker ({defaultdate: "+1w", Changemonth:true, Numberofmonths:3, OnC
Lose:function (selectedDate) {$ ("#rangeBa"). DatePicker ("option", "MaxDate", selectedDate);
}
}); });
The above JS code:
$ (' #file '). Customfileinput ({
button_position: ' Right '
});
3. Solutions