full calendar - associate clickable icons with events?

妖精的绣舞 提交于 2019-12-01 09:40:28

问题


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+");\" />"));
}

回答1:


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

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

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



来源:https://stackoverflow.com/questions/11537525/full-calendar-associate-clickable-icons-with-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!