Reputation: 19287
There is a html table populated dynamically from an ajax , on which there is a click handler on the tr element :
$("#table").on("click" ,"tr", function() {
// working codes
}
I want to get the corresponding clicked cell inside the above code. How to do that ?
Upvotes: 0
Views: 123
Reputation: 780724
Delegate to td
instead of tr
. Then this
will be the clicked cell.
$("#table").on("click" ,"td", function() {
console.log($(this).text());
}
Upvotes: 1