I am starting with first MVC application. Here i have the basic confusion. Actually the default \_Layout.cshtml file created like below

```
<!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>
    <script>

    </script>
    @RenderBody()

    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)
</body>
</html>

```

I used basic template so not have any template. But check the '@Scripts.Render("~/bundles/jquery")' line. Its after the @RenderBody(). So it actually it adds after the body section.

I think this is actually the best practice. But if i add $.(document).ready it shows the following error

Microsoft JScript runtime error: '$' is undefined

Based on the error, it because of script tag. I just moved the '@Scripts.Render("~/bundles/jquery")' line before @Render body and the final page like

```
<!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")
    @Scripts.Render("~/bundles/jquery")

</head>
<body>
    <script>

    </script>
    @RenderBody()      
    @RenderSection("scripts", required: false)
</body>
</html>

```

The applicationw works fine with my jquery. 

So why this is happened? So always the script adding tag need before @RenderBody ? Then why default template showing in wrong location?