jquery - Possible to ovveride javascript events? -
this question has answer here:
i wondering if it's possible have click event in javascript on both table row , icon column without tr event happening instead. table looks atm
<table id="the-table"> <tr> <td class="name">a name</td> <td class="description">a description</td> <td class="time">00:00:00</td> <td class="icons"><i class="fa fa-info"></i></td> </tr> <tr> <td class="name">a name</td> <td class="description">a description</td> <td class="time">00:00:00</td> <td class="icons"><i class="fa fa-info"></i></td> </tr> </table>
and have 2 click events bound it.
$( "#the-table tr" ).click(function() { //do }); $( "#the-table .icons i" ).click(function() { //do else });
but every time try fire click event on teh icon te table row event fires instead. possible catch tr event , fire icon click?
yes, call e.stoppropagation()
handler of icon click, click doesn't propagate ("bubble") row:
$( "#the-table .icons i" ).click(function(e) { e.stoppropagation(); //do else });
Comments
Post a Comment