Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to to include JavaScript into the page header MVC4
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/4311783/asp-net-mvc-3-razor-include-js-file-in-head-tag">ASP.Net MVC 3 Razor: Include js file in Head tag</a> </p> </blockquote> <p>I don't want to put a lots of JS into some layout and I need to do it for some specific pages I mean to include some of the JS into their header.</p> <p>I've tried like that but it doesn't work as it should be.</p> <pre><code>@{ Layout = "~/Views/Shared/_LayoutInner.cshtml"; @Scripts.Render("~/Scripts/farbtastic/farbtastic.js") @Styles.Render("~/Scripts/farbtastic/farbtastic.css") @Scripts.Render("~/Scripts/jquery.tinycarousel.min.js") @Scripts.Render("~/Scripts/jquery-ui-1.8.11.min.js") } &lt;script type="text/javascript" charset="utf-8"&gt; $(document).ready(function () { $('#slider1').tinycarousel(); $("#accordion").accordion(); $('#picker').farbtastic('#color'); }); &lt;/script&gt; </code></pre> <p>I have tried like that </p> <pre><code>@{ Layout = "~/Views/Shared/_LayoutInner.cshtml"; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/farbtastic/farbtastic.js")"&gt;&lt;/script&gt; &lt;link href="@Url.Content("~/Scripts/farbtastic/farbtastic.css")" rel="stylesheet" type="text/css" /&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery.tinycarousel.min.js")"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")"&gt;&lt;/script&gt; } </code></pre> <p>and no success at all.</p> <p>How I can archive it?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload