Why does the parent events apply automaticlly to the childs?
Hi guys ,
I am stuck with a little problem with JQuery , I want to apply an OnClick event to a parent div and all of its childs except one child, the child has its own Onclick event .
What happens is that when I click on that specific child , it executes its OnClick event and then executes the parent's event.
The problem here is that
I want the specific child to execute its event only without executing the parent event ...
that's my code :
-
$("#parent").click(function()
{
// executes the parent's event ......
// This applies to all childs ......
});
$("#specific-child").click(function()
{
// executes the child's event ......
});
And this is the HTML structure :
-
<div id="parent">
<div> text ....</div>
<div> text ....</div>
<div> text ....</div>
<div> text ....</div>
<div id="specific-child"> specific content over here ...</div>
</div>