I'm new to ASP.NET MVC 4 and I would like to add a jquery control in one of the pages of my project.
Here is the end part of my _layout.cshtml file :
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
1. What exactly does the @Script.Render("~/bundles/jquery") line ?
Inside the page where I want my control added :
@{
ViewBag.Title = "Test page";
}
@section scripts
{
@Scripts.Render("~/Scripts/jquery-1.8.2.js") // The control needs jquery.
@Scripts.Render("~/Scripts/icarousel.min.js") // The control in question.
@Styles.Render("~/Content/icarousel.css") // A css file needed by the control.
}
<script type="text/javascript">
$(document).ready(function () {
$('#icarousel').iCarousel();
});
</script>
(some html code here, including the #icarousel div ... )
When I run that page, I get the error : '$' is undefined.
It's like jquery is not loaded or something ...
2. What am I missing to make this work ?