jquery - Possible to ovveride javascript events? -


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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -