8

I'm getting this error only in IE in my MVC site:

SCRIPT5007: Unable to get property 'call' of undefined or null reference jquery.validate.js, line 1234 character 5

I've looked around quite a bit for answers, and cannot find a solution. Chrome works fine. When I Google the exact error message, I was led here: script bundle not working, but answers there didn't help me.

I tried updating my jQuery and jQuery validation plugins via Visual Studio NuGet package manager. I upgraded jQuery to version 2.0.3 and jQuery Validation 1.11.1. I think I had jQuery 1.9.x before. This had no effect.

I believe my bundles are standard:

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

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

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

and at the tail end of my layout page, these are my Scripts.Render calls:

        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/jqueryui")
        @Scripts.Render("~/bundles/jqueryval")
        @RenderSection("Scripts", false)
    </body>    
</html>

any help is greatly appreciated.

4

1 回答 1

5

I installed Bootstrap MVC4 via NuGet when the exact error happened to my app. The latest Bootstrap MVC4 install removes jquery-1.8.2* and installs jquery-1.9.1* as dependencies. jquery.validate was apparently not playing nice with jquery-1.9.1. https://github.com/jzaefferer/jquery-validation states they are not addressing any IE-Compatibility-Mode-related problems (understandably). Trouble is, I was running IE10 - Compatibility Mode off, and I was still getting the error. I added all the latest versions of all the jquery files in my project, removed the older ones from the project, and success in IE!

于 2013-10-11T17:33:39.213 回答