MeteorJS: How to get clicked element

前端 未结 2 1314
慢半拍i
慢半拍i 2021-01-20 16:59

I\'m trying to get the clicked element so that I can add class. Does Meteor provides any way to get the current element like jQuery $ (this)

Template.retrain         


        
2条回答
  •  鱼传尺愫
    2021-01-20 16:59

    To get the element on which the event occurred, use event object.

    event.target
    

    As you've jQuery included, you can wrap the element in jQuery to use jQuery methods on it.

    $(event.target)
    

    You can see this in Meteor Tutorial

提交回复
热议问题