I have recentely upgraded a website to use ASP.NET MVC 4 and have the following code to render my jQuery validation bundle.
But I get the following error:
The .live method has been deprecated in jQuery v1.7+ and removed in jQuery v1.9+.
Bugreport: http://bugs.jquery.com/ticket/13213
Explanation:
http://jquery.com/upgrade-guide/1.9/#live-removed
.live() removed
The .live() method has been deprecated since jQuery 1.7 and has been removed in 1.9. We recommend upgrading code to use the .on() method instead. To exactly match $("a.foo").live("click", fn), for example, you can write $(document).on("click", "a.foo", fn). For more information, see the .on() documentation. In the meantime, the jQuery Migrate plugin can be used to restore the .live() functionality.
How to fix: Download the jquery migrate plugin and add it to your bundling:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-migrate-{version}.js"));
Update: The migrate plugin is now available from Nuget as well:
PM> Install-Package jQuery.Migrate