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 ?

2
  • Could you share your code please, it makes answering a lot easier and more effective. Commented Mar 8, 2014 at 17:42
  • exact duplicate of Prevent execution of parent event handler Commented Mar 8, 2014 at 17:43

1 Answer 1

6

Use event.stopPropagation() on button click

It will stop the propagatotin to the parent

$("#buttonid").click(function(e){
  e.stopPropagation() 
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.