最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - full calendar - associate clickable icons with events? - Stack Overflow

programmeradmin2浏览0评论

I want to append 4 icons each event on the calendar. Each icon should calls different function on click event. To be honest, I am not too good in CSS. I have tried the below code but the click event for these icon is not invoked. Instead events event is invoked. Is there anyway to append 4 icons with clickable event? Thank you in advance

eventRender: function(event,element,calEvent) {
    element.find(".fc-event-title").after($("<span class=\"fc-event-icons\"></span>").html("<img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" />"));
}

I want to append 4 icons each event on the calendar. Each icon should calls different function on click event. To be honest, I am not too good in CSS. I have tried the below code but the click event for these icon is not invoked. Instead events event is invoked. Is there anyway to append 4 icons with clickable event? Thank you in advance

eventRender: function(event,element,calEvent) {
    element.find(".fc-event-title").after($("<span class=\"fc-event-icons\"></span>").html("<img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" />"));
}
Share Improve this question edited Jul 18, 2012 at 9:03 stephen asked Jul 18, 2012 at 8:46 stephenstephen 691 gold badge2 silver badges11 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

I think you need to use the .on() function to register an event handler to your icons.

Check this fiddle: http://jsfiddle/100thGear/rpc23/

The click events get triggered and are handled appropriately with the .on() handler. Let me know if this helps!

发布评论

评论列表(0)

  1. 暂无评论