I have a basic table with different data displayed in rows and columns. I want to make the entire row clickable so that when clicked, something happens.
By default, the <td>
elements inside the table act as event targets, but I specifically want only the table row to be the target for the click event. To achieve this, I tried the following:
td {
pointer-events: none;
}
tr {
cursor: pointer;
}
Although this approach worked fine when using <div>
tags containing <span>
elements, it doesn't behave the same way with <tr>
and <td>
. Even after adding pointer events, the table row still does not respond to any click events.
Is there anyone who knows of a workaround or solution to this problem?