I'm trying to figure out how to use the jquery fullCalendar control. I can't get past the very first line which simply attaches a calendar to a "div". Straight from the fullCalendar home page. I'm pretty sure I have jQuery referenced correctly in my master page since I can get other simple controls to work. What am I missing? Is fullCalendar NOT compatible with ASP.Net MVC 2 and jQuery 1.5?
Pretty simple code. The error I get is: "Microsoft JScript runtime error: Syntax error, unrecognized expression: [#calendar]". Here's the code:
<asp:Content ID="Content2" Co开发者_StackOverflowntentPlaceHolderID="MainContent" runat="server">
<script src="../../Scripts/fullcalendar/fullcalendar.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('[#calendar]').fullCalendar({
theme: true,
header: {
left: '',
center: '',
right: ''
},
defaultView: 'agendaDay',
editable: false,
events: "/Calendar/GetEvents/"
});
});
</script>
<div id="calendar"></div>
Try:
<script type="text/javascript">
$(document).ready(function () {
$('#calendar').fullCalendar({
theme: true,
header: {
left: '',
center: '',
right: ''
},
defaultView: 'agendaDay',
editable: false,
events: "/Calendar/GetEvents/"
});
});
</script>
Note the lack of []
. In jQuery a div's ID is referenced by # only. See the ID selector for more details.
精彩评论