You need to add an event listener to your table and then get the event’s target innerHTML like this:
yourTable.addEventListener('click', function (event) {
console.log(event.target.innerHTML);
});
You don’t need to add a listeners to each cell this is a waste of resources, use one global listener for the table.
10
solved How to find content of a specific cell with row and column index?