Using Jquery $(this) in Meteor
Asked Answered
I

1

8

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?

Igraine answered 2/8, 2012 at 3:23 Comment(0)
O
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'));
  }
};
Obstacle answered 2/8, 2012 at 6:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.