我正在使用jQuery
Full Calendar
并试图填写clickEvent
上的文字字段
随着活动的时间。
time
是我Event
模型中属性的名称。
$(document).ready(function() {
$('#calendar').fullCalendar({
eventClick: function() {
// set value?
$('#time').val("<%= @event.time %>");
}
})
});
HTML来源:
<article class="blog-post margin-60">
<div id="calendar" class="fc fc-ltr">
<table class="fc-header" style="width:100%">
<tbody>
<tr>
<td class="fc-header-left">
<span class="fc-header-title"><h2>Oct 20 — 24 2014</h2></span>
</td>
<td class="fc-header-center"></td>
<td class="fc-header-right">
<span class="fc-button fc-button-today fc-state-default fc-corner-left fc-corner-right fc-state-disabled" unselectable="on">today</span>
<span class="fc-header-space"></span>
<span class="fc-button fc-button-prev fc-state-default fc-corner-left" unselectable="on"><span class="fc-text-arrow">‹</span></span><span class="fc-button fc-button-next fc-state-default fc-corner-right" unselectable="on">
<span class="fc-text-arrow">›</span></span></td></tr></tbody></table><div class="fc-content" style="position: relative;"><div class="fc-view fc-view-basicWeek fc-grid" style="position:relative" unselectable="on">
<div class="fc-event-container" style="position:absolute;z-index:8;top:0;left:0">
<div class="fc-event fc-event-hori fc-event-start fc-event-end" style="position: absolute; left: 3px; width: 147px; top: 24px;">
<div class="fc-event-inner"><span class="fc-event-title">08:00:00</span></div>
</div>
<div class="fc-event fc-event-hori fc-event-start fc-event-end" style="position: absolute; left: 3px; width: 147px; top: 47px;">
...
我错过了什么?
答案 0 :(得分:0)
eventClick: function(event) {
$('#time').val(event.start);
}
请参阅eventClick和Event_Object以供参考。基本上你使用你传入的javascript事件对象。你需要做一些处理来获得时间,但这不应该太困难。