1

lets say I have something like this:

'click #url_image': function(e) { 
  var className = $(this).attr("class");
  console.log(className);
}

"this" in meteor is the context of the current template, not the actual item which was clicked. how could I get the class or other attribute from the actual click event, in this case the class of #url_image?

Thanks

user3238454
  • 64
  • 1
  • 9

2 Answers2

13

Try

$(e.currentTarget).attr("class");
user1934044
  • 516
  • 5
  • 18
5

Or if you want a no-jQuery solution:

e.currentTarget.getAttribute('class');
martpie
  • 5,510
  • 1
  • 21
  • 25