Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Click events on overlapping items

I have

  • table row with click event
  • button with click event, that button is on table row

and I have problem. When I hit button, row click event execute too, but I don't want this behavior. I want only button click execute, without row click.

like image 589
MicTech Avatar asked Nov 13 '09 12:11

MicTech


2 Answers

Using jQuery (due to question tag):

$('#yourButton').click(function(e) {
    // stop event from bubbling up to row element
    e.stopPropagation();

    // now do your stuff
});
like image 197
stpe Avatar answered Nov 08 '22 04:11

stpe


look at your code this is what you should do in the button click event stopPropagation

like image 8
andres descalzo Avatar answered Nov 08 '22 02:11

andres descalzo