Reputation: 83
I'm using on-tap to detect element clicks.
<div id="parent" on-tap="myclickEvent">
<h1>Some text<h1>
</div>
But when i click on it, the target attribute in the fired event is the h1. How do I change to make the parent element be the target?
Upvotes: 3
Views: 3358
Reputation: 32154
here is very useful notes you should take care of:
Polymer.dom(event).rootTarget
Upvotes: 2
Reputation: 3734
Try e.currentTarget
. Don't expect it to be shown in console.log
though as that browser function is asynchronous in Chrome (actually don't even bother logging event objects or objects inside events). But you can see it actually returns a div
if you try this in your code.
myclickEvent: function(e){
...
var tag = e.currentTarget.tagName;
console.log(tag);
}
Upvotes: 9