I have a problem with event in meteor app. I have a place in code for "active" person. When that person stopa being active a new person appears I need to get the ID of that person on click
'click .person .fa-close': function(event, template) {
event.preventDefault();
var getid = $(event.target);
console.log(getid.data('id'));
}
On the first click I will get correct data id, but when the new person with a new id shows up, in console.log I will get the old ID.
When I log event.target I have a good target with good id. But when I want to get ID, I end up with the old one. Anyone?
答案 0 :(得分:0)
$(event.target).attr('data-id')
我将.data更改为.attr并且可以正常工作