0

I have an application MVC4 which I just started. I run the solution and get an error:

Microsoft JScript runtime error "The object doesn't accept this property or method"

My Index.cshtml file

@{
    ViewBag.Title = "Menu Principal";
}

<h2>Home</h2>

My _Layout.cshtml

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")

</head>
<body>
    @Scripts.Render("~/bundles/jquery")

    @RenderSection("scripts", required: false)

    @RenderBody()
</body>
</html>

I tagged in "razor" because all links I have seen talk about razor sections. I have taken a look into the following links which proved to help others with similar problems, but could not make it work for me:

  1. ASP.NET MVC 3: Layouts and Sections with Razor
  2. MVC 4 and Jquery tricks

I already tried:

  • Placing the "@Scripts.Render("~/bundles/jquery")" sentence before closing the head tag
  • Placing the RenderBody before the RenderSection
  • Removing the RenderSection (although this shouldn't be the problem, because debugging I've seen it crashes in the RenderBody sentence)

The exact line in which it crashes, within the jquery-2.0.0.js file, is in the following one:

window.addEventListener( "load", completed, false );

Any help is much appreciated.

1 Answer 1

1

You're using jQuery 2.0 on IE < 9, which it does not support.

Upgrade IE or downgrade jQuery.

Sign up to request clarification or add additional context in comments.

1 Comment

incredible, all day fighting with this and it turned out to be something so simple. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.