Javascript 在Meteor中使用Jquery$(this)
如何在meteor中使用此函数?例如,我希望能够单击任何给定的元素,并找出它的类是什么。另外,我如何获得有关我使用Meteor单击的项目的信息?假设在代码中的某个地方有一个处理事件的模板:Javascript 在Meteor中使用Jquery$(this),javascript,jquery,this,meteor,self,Javascript,Jquery,This,Meteor,Self,如何在meteor中使用此函数?例如,我希望能够单击任何给定的元素,并找出它的类是什么。另外,我如何获得有关我使用Meteor单击的项目的信息?假设在代码中的某个地方有一个处理事件的模板: Template.tmpl_name.events = { 'click #logo': function (e) { // Instead of using $(this), you can do: var $this = $(e.target); // Your usual c
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'));
}
};