最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using Jquery $(this) in Meteor - Stack Overflow

programmeradmin3浏览0评论

How can I use the this function in meteor? for example, I want to be able to click on any given

element and find out what its class is. Also, how can I get information on the item that I click on with Meteor?

How can I use the this function in meteor? for example, I want to be able to click on any given

element and find out what its class is. Also, how can I get information on the item that I click on with Meteor?

Share Improve this question asked Aug 2, 2012 at 3:23 illathruzillathruz 1553 silver badges9 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 17

Let's say somewhere in the code you have a template handling events:

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'));
  }
};
发布评论

评论列表(0)

  1. 暂无评论