1

I have a click event attached to a table row and within columns i have checkboxes.

<table>
    <tbody>
        <tr class='shop_order_single_table'>
            <td><input type='checkbox' /></td>
            <td><input type='checkbox' /></td>
            <td><input type='checkbox' /></td>
        </tr>
    </tbody>
</table>

When i click the checkbox the click event for the row still executes.

Here is my code:

     $(".shop_order_single_table").on("click",function() {
   //click event executes
                });

How do i have the click event for the table row not execute when clicking a checkbox?

user892134
  • 3,078
  • 16
  • 62
  • 128
  • http://stackoverflow.com/questions/9183381/how-to-have-click-event-only-fire-on-parent-div-not-children – Jordumus Apr 01 '15 at 12:33
  • Please see ["Should questions include “tags” in their titles?"](http://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles), where the consensus is "no, they should not"! –  Apr 01 '15 at 13:28

1 Answers1

1
$(".shop_order_single_table input").on("click", function(e) { 
   e.stopPropagation();
});   

$(".shop_order_single_table").on("click", function(e) { 
   // Your code
});
Timur Osadchiy
  • 5,699
  • 2
  • 26
  • 28