0

There is a click event assigned to the parent tr class name type-shop_order. When clicking a child element checkbox this successfully stops the parent click event from firing.

When clicking a child element anchor tag, the type-shop_order click event still fires.

$(".type-shop_order .shop_order_single_table input[type='checkbox']").on("click", function(e) { 
   e.stopPropagation();
});         

$(".type-shop_order .shop_order_single_table a").on("click", function(e) { 
   e.stopPropagation();
}); 

How do i solve? The first works but the second doesn't.

The parent click event is slideDown for a child div in a table cell.

The anchors are added dynamically with jquery btw.

user892134
  • 3,078
  • 16
  • 62
  • 128
  • There is no reason for it to not work... Can we know a bit more about the event you are trying to prevent from occurring? And what "does not work" mean exactly? what does it do when it does not work? – Salketer Apr 14 '15 at 14:16
  • Can you post a complete code example including the HTML? – j08691 Apr 14 '15 at 14:17
  • see edit. The anchors are added dynamically btw. – user892134 Apr 14 '15 at 14:21
  • 2
    @user892134 "The anchors are added dynamically btw." Well, that's your problem; look up one of the many, many questions and answers on event delegation here on SO. – Anthony Grist Apr 14 '15 at 14:23
  • possible duplicate of [Event binding on dynamically created elements?](http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements) – JJJ Apr 14 '15 at 14:25

0 Answers0