我正在使用完整的日历 jQuery 组件,我也在尝试通过 div 循环来添加事件 .. 但它不起作用..
这是Javascript代码..注释行是添加时有问题的代码..
$(document).ready(function() {
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
editable: true,
events: [
//$("div.allEvents").each( function ( index ){ when I add this to the Jquery code .. it doesn't work
{
//title: $(this).children('#event').val(), replace this by the next line
title: $('#event').val(),
//start: new Date( y, m, $(this).children('#date').val() ) replace this by the next line
start: new Date( y, m, $('#date').val() )
},
//} ); End of each loop
]
});
});
这是CSS和HTML代码..
<div class="allEvents">
<input type='hidden' id='event' value='Alaa' />
<input type='hidden' id='date' value='21' />
</div>
<div class="allEvents">
<input type='hidden' id='event' value='Waheeb' />
<input type='hidden' id='date' value='29' />
</div>
<style type='text/css'>
body {
margin-top: 40px;
text-align: center;
font-size: 14px;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 900px;
margin: 0 auto;
}