I'n new to javaScript and jQuery. How is this possible to call the click event of parent element when you click its child? I have this structure in my code:
<ul id="pc5">
<li><a href="#">book</a>
</li>
</ul>
I want something like this:
$("a").click(ul.click);
Any help would be appreciated.
EDIT: in my ul click function I need ul id attribute. something like this:
ul.click(function(e){alert(e.target.id);
so when link is clicked, event.target isn't ul element.
click
event from thea
element will bubble to theul
, unless you usereturn false;
orevent.stopPropagation
on thea
click handler. – Rory McCrossan