KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: Table row and column number in jQuery If I have a table like so: <table> <thead> <tr><th>1</th> <th>2</th> <th>3</th></tr> </thead> <tbody> <tr><td>data</td> <td>checkbox</td> <td>data</td></tr> </tbody> </table> When the user clicks the checkbox, I want to get the row and column indices. I can get the row index by using this code: var row = $(this).parent().parent(); var rowIndex = $(row[0].rowIndex); but I can't figure out the column index... I tried this but it didn't work: var colIndex = $(row.children().index(this).parent()); I looked through the results of similar questions here and it seems I have to iterate through all the tds with each or map, is there something simpler that I can use? Thanks.
Tags (comma-separated)
Save Edits
Cancel