Clickable cells in HTML table

emormInue

New Member
I have a table in HTML, with about 20 columns and 10 rows. Each column has a letter and each row has a number. What is the best way to make each cell clickable, so that it performs a JavaScript function and passes in the coordinates?I've thought of going each cell an id or onclick attribute an hardcoding the coordinates, however makes expanding the table harder in the future and just seems inefficient.I would think it would be easy to get the row the cell is in, just get the parent element. But I've no idea how to get the column?This is there an established way of getting both the row and column of a cell?
 
Back
Top