jquery - is not a function error

后端 未结 7 479
傲寒
傲寒 2020-11-30 02:06

Here is my code:

(function($){
    $.fn.pluginbutton = function (options) {
        myoptions = $.extend({ left: true });
        return this.each(function (         


        
7条回答
  •  孤独总比滥情好
    2020-11-30 02:50

    When converting an ASP.Net webform prototype to a MVC site I got these errors:

    TypeError: $(...).accordion is not a function
    $("#accordion").accordion(


    $('#dialog').dialog({
    TypeError: $(...).dialog is not a function

    It worked fine in the webforms. The problem/solution was this line in the _Layout.cshtml

    @Scripts.Render("~/bundles/jquery")
    

    Comment it out to see if the errors go away. Then fix it in the BundlesConfig:

    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
    "~/Scripts/jquery-{version}.js"));
    

提交回复
热议问题