8

如何在流星中使用此功能?例如,我希望能够点击任何给定的

元素并找出它的类是什么。另外,我怎样才能获得关于我用 Meteor 点击的项目的信息?

4

1 回答 1

17

假设在代码中的某处您有一个模板处理事件:

Template.tmpl_name.events = {
  'click #logo': function (e) {
    // Instead of using $(this), you can do:
    var $this = $(e.target);
    // Your usual code here, e.g.:
    console.log($this.attr('href'));
  }
};
于 2012-08-02T06:37:21.947 回答