event propogation Jquery

          $('#submenuDiv').click(function (e) {
$("body").click(function () {

Open in new window

snippet of code in my $(document).ready(function is shown above.
div.submenuDiv is contained in div.resultsDiv. I put a breakpoint at e.stopPropogation and also within the $("body").click function.

when I click within the div.submenuDiv then both the breakpoints get hit. why? should the e.stopPropogation not allow the second breakpoint from being hit?
Who is Participating?
Chris StanyonConnect With a Mentor Commented:
Also, in your question you say you have a 'div.submenuDiv' - this is a DIV with a class of submenuDiv, yet in your jQuery code, you are attaching the click event to an element with an ID of submenuDiv

#submenuDiv - ID
.submenuDiv - Class
Chris StanyonConnect With a Mentor Commented:
You've got a typo in your code. It should be:

sanagarwlAuthor Commented:
thank you. couple of typos - sorry about that. the div.submenuDiv is incorrect - both are ids

e.stopPropagation worked - I put in a false and that was working just fine which is a combination of e.preventDefault and e.stopPropagation.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.