I have a structure like this:
<tr>
 <td onClick="doSomeStuff();">
  <a href="#" onClick="doOtherStuff(1);">1</a>
  <a href="#" onClick="doOtherStuff(2);">1</a>
 </td>
</tr>
My problem is that doSomeStuff() always executes, no matter that I am clicking on a <a href> element.
How I can fix this?
If you're using plain javascript. Try this
JS
function doOtherStuff(event,arg) {
        event.stopPropagation();
}
HTML
<tr>
     <td onClick="doSomeStuff();">
            <a href="#" onClick="doOtherStuff(event,1);">1</a>
            <a href="#" onClick="doOtherStuff(event,2);">1</a>
     </td>
</tr>
                        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