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);
            });
        }

更多相关文章

  1. 使用jquery 1.11.3.min.js时,jquery on click事件未触发。
  2. bootstrap,模态对话框,shown.bs.modal事件不会触发
  3. 更改html隐藏字段的事件
  4. JQuery 总结(3) jQuery 各种事件
  5. jQuery 选择器 与 事件
  6. jquery不会对select/选项更改事件作出反应。
  7. 使用HTML5验证时如何绑定到提交事件?
  8. jquery自定义事件
  9. jQuery学习笔记- focus和blur事件妙用

随机推荐

  1. 12个非常有用的JavaScript技巧
  2. 浏览器独立文件io在javascript中
  3. 根据php对ajax请求的响应制作动态html表
  4. Javascript XML DOM将属性设置为特定元素
  5. arcgis api for js入门开发系列十 自定义
  6. 上传文件进度条(笔记)
  7. 整理简易分享功能
  8. Cordova相机插件ios11无法从库中选取图像
  9. 韩顺平 javascript教学视频_学习笔记12_j
  10. setInterval在Chrome上不能正常工作