panthro panthro - 1 year ago 202
jQuery Question

jQuery: get parent, parent id?

<ul id ="myList">
<li><a href="">link</a></li>

How can I get the id of the ul (myList) using jQuery? My j-script event is triggered when the a link is clicked. I have tried:


But it gets the id of the li, I need to go one higher, and I cant attach the click to the li either.

Answer Source

Is how you would get the id of the parent's parent.



Is a more foolproof solution for your case.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download