fullcalendar.js - 在按钮点击时删除事件
I am using the fullCalendar.js and the current problem is making i lose so much time on something that might be simple to whose understand javascript (more specific jquery) better than me.
我正在使用fullCalendar.js,当前的问题是让我失去了太多时间在一些可能比我理解的javascript(更具体的jquery)更简单的东西上。
The link of my example is at the bottom but my main concern is this part:
我的例子的链接在底部,但我主要担心的是这部分:
eventClick: function(event){
$(".closon").click(function() {
$('#calendar').fullCalendar('removeEvents',event._id);
});
},
I want to delete an event from the calendar with my close button and not on direct click of the event. I already tried using the $element.click
outside of the eventClick trigger but it closed all the events on the calendar and the max i could reach was this poor situation, where the user need to click first on the calendar event and after on the 'X' to delete it.
我想通过关闭按钮从日历中删除事件,而不是直接点击事件。我已经尝试在eventClick触发器之外使用$ element.click,但它关闭了日历上的所有事件,并且我可以达到的最大值是这种糟糕的情况,用户需要先点击日历事件,然后点击' X'删除它。
http://jsfiddle.net/59RCB/49/
http://jsfiddle.net/59RCB/49/
5 个解决方案
#1
29
Remove the eventClick function and replace the eventAfterAllRender function with this:
删除eventClick函数并将eventAfterAllRender函数替换为:
eventRender: function(event, element) {
element.append( "<span class='closeon'>X</span>" );
element.find(".closeon").click(function() {
$('#calendar').fullCalendar('removeEvents',event._id);
});
}
更多相关文章
- 使用jquery 1.11.3.min.js时,jquery on click事件未触发。
- bootstrap,模态对话框,shown.bs.modal事件不会触发
- 更改html隐藏字段的事件
- JQuery 总结(3) jQuery 各种事件
- jQuery 选择器 与 事件
- jquery不会对select/选项更改事件作出反应。
- 使用HTML5验证时如何绑定到提交事件?
- jquery自定义事件
- jQuery学习笔记- focus和blur事件妙用