Reputation: 53291
How do I get the ID of a list element? Whenever I use this.id
it gives me the ID of the parent table. Here's my code:
$('*').bind('tap', function() {
selectBrick(this.id);
alert(this.id)
});
Upvotes: 0
Views: 135
Reputation: 13620
It seems your selector '*'
is binding the tap event to the table. You could try to use the event object and see if what target
is - this should be the DOM element that was actually subjected to the event.
$('*').bind('tap', function(event) {
selectBrick(event.target.id);
alert(event.target.id)
});
Upvotes: 1