在Meteor中使用Jquery $(this)

ill*_*ruz 8 javascript jquery this self meteor

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

元素并找出它的类.另外,如何获取有关我使用Meteor点击的项目的信息?

nsm*_*eta 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'));
  }
};
Run Code Online (Sandbox Code Playgroud)