126
rated 0 times
[
130]
[
4]
/ answers: 1 / hits: 98792
/ 9 Years ago, fri, september 4, 2015, 12:00:00
I have an onclick event in a table both on a <td>
and <tr>
elements. I need when the user clicks on the specific column (<td>
), the <tr>
event won't be triggered, only the <td>
one.
How to do it ?
Example :
HTML :
<tr onclick='trclick();'>
<td>Column 1</td>
<td>Column 2</td>
<td onclick='tdclick();'>Column 3</td>
</tr>
JS :
function trclick(){console.log('tr clicked')};
function tdclick(){console.log('td clicked')};
When the user clicks on 'Column 3', both events are triggered, but i want only tdclick()
to be triggered.
More From » javascript