For this problem, I'm going to assume that the table will have a <thead>
(for the clickable elements) and a single <tbody>
.
A good thing to know is that a <table>
element in JS has a special interface HTMLTableElement that allows us to perform a few selections / actions easily. So once we select our element:
const table = document.querySelector('table')
We have access to its entire structure. For example: