In Visual Studio 2013 I made a new project based on the default MVC4 Intranet template. In the _Layout.cshtml I added some custom code to add a test link in a div container.
<!DOCTYPE html>
<html lang="en">
<head>
@Scripts.Render("~/bundles/jquery","~/bundles/modernizr")
<meta charset="utf-8" />
<title>@ViewBag.Title - My ASP.NET MVC Application</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
@Styles.Render("~/Content/css")
</head>
<body>
<header>
<div class="content-wrapper">
<div class="float-left">
<p class="site-title">@Html.ActionLink("your logo here", "Index", "Home")</p>
</div>
<div class="float-right">
<section id="login">
Hello, <span class="username">@User.Identity.Name</span>!
</section>
<nav>
<ul id="menu">
<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>
<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
</ul>
</nav>
</div>
</div>
</header>
<div id="body">
@RenderSection("featured", required: false)
<section class="content-wrapper main-content clear-fix">
@RenderBody()
</section>
<div id="test"></div>
</div>
<footer>
<div class="content-wrapper">
<div class="float-left">
<p>© @DateTime.Now.Year - My ASP.NET MVC Application</p>
</div>
</div>
</footer>
@RenderSection("scripts", required: false)
<script type="text/javascript">
$(function () {
$("#test").append("<a href='#'>test linkje</a>");
});
</script>
</body>
</html>
When I press F5 and go into Internet Explorer 10 everything is working fine. The problem starts occuring when a HTML Actionlink is clicked. Then Visual Studio comes in between with the error message:
0x800a1391 - JavaScript runtime error: '$' is undefined
After pressing continue and hitting F5 in the browser its working again. I dont have this problem when running it in Firefox or Chrome. Even when im running it in Chrome or Firefox and I am pasting the url in IE 10 its working fine.
Seems to me running it under IE10 directly messing things up. Hopefully someone has a solution for this strange error, since all the code is just fine.
Thanks in advance.