Ruby on rails jquery fullcalendar在i';我在rails中使用jQueryReplaceWith
我在rails中实现了jquery full calendar,但是当我替换div id=“calendar”时,我得到了重复的日历 我将继续学习本教程: 当我选择下拉值时,我希望选择具有不同值的日历 这是我的代码:Ruby on rails jquery fullcalendar在i';我在rails中使用jQueryReplaceWith,ruby-on-rails,fullcalendar,Ruby On Rails,Fullcalendar,我在rails中实现了jquery full calendar,但是当我替换div id=“calendar”时,我得到了重复的日历 我将继续学习本教程: 当我选择下拉值时,我希望选择具有不同值的日历 这是我的代码: <%= link_to "new event", filter_path_new_event, class: "btn btn-primary" %> <br><br> <%= label_tag "select_spa_:" %>
<%= link_to "new event", filter_path_new_event, class: "btn btn-primary" %>
<br><br>
<%= label_tag "select_spa_:" %>
<%= select_tag "sleect_spa", "<option>Select Spa</option><option>Park Cities</option><option>Addison</option>".html_safe, onchange: "select_spa()" %>
<br>
<div id='calendar'></div>
<script>
function select_spa(){
var place = $("#sleect_spa").val();
var events = "";
if(place != "Select Spa"){
events = "/events?place="+place+"&start=2014-05-23&end=2014-09-26";
}else{
events
}
$('#calendar').fullCalendar({
editable: true,
selectable: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaDay',
height: 800,
firstHour: 10,
minTime: 9,
maxTime: 22,
slotMinutes: 15,
events: events,
timeFormat: 'h:mm t{ - h:mm t} ',
dragOpacity: "0.5"
});
return false;
}
</script>
函数选择_spa(){
var place=$(“#sleect_spa”).val();
var事件=”;
如果(地点!=“选择水疗”){
events=“/events?place=“+place+”&start=2014-05-23&end=2014-09-26”;
}否则{
事件
}
$(“#日历”).fullCalendar({
是的,
是的,
标题:{
左:“上一个,下一个今天”,
中心:'标题',
右图:“月,agendaWeek,agendaDay”
},
defaultView:'agendaDay',
身高:800,
第一小时:10,
时间:9,,
最长时间:22,
慢分钟:15,
事件:事件,
时间格式:“h:mmt{-h:mmt}”,
牵引能力:“0.5”
});
返回false;
}
修复我的问题,将此代码置于调用之前(“#calendar”)。fullCalendar()
$(".fc-header").remove();
$(".fc-content").remove();