Thursday, August 28, 2014

JavaScript runtime error: Unable to get property 'call' of undefined or null reference

I got this error after I had installed a NuGet package with editor templates for Bootstrap for ASP.NET MVC 5.

The solution consisted of 2 steps:
First, install package JQuery Migrate. Second, edit the method RegisterBundles in class BundleConfig from App_Start folder and change the part where it adds the bundle jqueryval.

Initially, in my project, it looked like this:

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                          "~/Scripts/jquery.validate*"
                        ));


Here you have to add a line to include the jquery-migrate files:

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery-migrate*",
                        "~/Scripts/jquery.validate*"
                        ));



No comments:

Post a Comment