2

I have whole div you can click on which toggles the main part of that div. The problem is I also have clickable button in that div and when I click on it it does what it should but also toggles the whole div at the same time!

How can I disable that ?

Paweł Bąkiewicz
  • 207
  • 1
  • 2
  • 8
  • Could you share your code please, it makes answering a lot easier and more effective. – matthijs Mar 08 '14 at 17:42
  • exact duplicate of [Prevent execution of parent event handler](http://stackoverflow.com/questions/1398582/prevent-execution-of-parent-event-handler) – Felix Kling Mar 08 '14 at 17:43

1 Answers1

6

Use event.stopPropagation() on button click

It will stop the propagatotin to the parent

$("#buttonid").click(function(e){
  e.stopPropagation() 
});
Anoop Joshi P
  • 25,373
  • 8
  • 32
  • 53