Hey guys, I'm studying to do the MVC4 exam for Microsoft and im running in to a little issue. I'm trying to re-create an old project I done a while back in Web forms in MVC and its proving rather difficult. Ok my problem, I have a bunch of javascript files which look for a div with an id of calender and create a calender control, No matter what I try in MVC I can't get it to work but in Web forms it works like a treat. So I'm trying to access the Calendar div in the Index.cshtml file but no matter what I try I always get underfined
_Layout.cshtml
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/jquery-ui.min.css")
@Styles.Render("~/Content/fullcalendar.css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/Scripts/jquery-2.1.0.js")
@Scripts.Render("~/Scripts/jquery-ui-1.10.4.js")
@Scripts.Render("~/Scripts/fullcalendar.js")
@Scripts.Render("~/Scripts/jquery-ui.custom.min.js")
@Scripts.Render("~/Scripts/Calendar.js")
</head>
Index.cshtml
<pre lang="xml">@{
ViewBag.Title = "Calendar";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Calendar</h2>
<div id="calendar"></div></pre>
Calendar.js
var calendar = $('#calendar');
var calendar = $('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
So in Calendar.js I always get underfined when I try to access the calendar div.
Any help is very much apreciated, bearing in mind that all I have developed in thus far is web forms so if its something silly im missing be nice :).