<tr class="DesignedTableTR" onclick="OpenAdPreview()">
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
I want that the onclick
will be set on all the td-s except for the second td.
I know I can do it like:
<tr class="DesignedTableTR">
<td onclick="OpenAdPreview()"></td>
<td></td>
<td onclick="OpenAdPreview()"></td>
<td onclick="OpenAdPreview()"></td>
</tr>
but maybe there is another efficient way..
Another way for doing
<tr class="DesignedTableTR" onclick="OpenAdPreview()">
<td></td>
<td onclick="event.cancelBubble=true; return false;"></td>
<td></td>
<td></td>
Use the :not()
and :nth-child()
selectors.
$("tr.DesignedTableTR > td:not(:nth-child(2))").on("click", OpenAdPreview);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With