Click here to Skip to main content
15,905,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In a dynamically created table, there are multiple rows, and each row contains 7 cells. When I click a cell of a row, I want to find out which cell is actually picked using the jQuery (see the code below). In debugging, I went though the 'this' item. In the this.cells, the 7 cells are on the list. But I could not find the property that shows whether the cell is actively selected or not. What's the proper approach to find out if a cell is picked or not? Thanks.

JavaScript
$('#selectedListTable').on('click', 'tr', function () { 
   ...
});


What I have tried:

How to find out which cell is picked by a clicking event through jQuery?
Posted
Updated 8-Dec-16 18:41pm

1 solution

try this,
replace the tr with td, by doing so the this object will be filled with current cell object.
JavaScript
$('#selectedListTable').on('click', 'td', function () { 
   ...
});
 
Share this answer
 
Comments
s yu 9-Dec-16 10:55am    
Thanks for your response. It works well. Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900