我已经使用jQuery在行中完成了事件委托,如下所示:
// row is dynamically created, MarketingTaskTracker is js constructor function inside which i've defined my functions (eg editMTTDetails, prepareDataForMTTDetails)
$(row).on("click", "input[type='checkbox']", {eventID: eventID, marketingTaskCode: marketingTaskCode}, MarketingTaskTracker.editMTTDetails);
this.editMTTDetails = function(event) {
// I can access information related to event here i.e alert(event.data.eventID)
// I want to pass the event in function below and be able to access information related to event
//this.prepareDataForMTTDetails(event);
};
this.prepareDataForMTTDetails = function(event) {
// Need to be able to access event related data in this function as below
alert(event.data.eventID);
alert(event.data.marketingTaskCode);
alert($(event.target).attr("id"));
};
我只是希望能够将事件从事件处理函数传递到另一个函数,并在第二个函数中访问事件相关信息。