Reputation: 12171
<ul id="productmenu"> <li> <a ref="#"></a> </li> </ul>
how to check if a link's parent's parent has got an id = "productmenu"? I tried with PrentNode, but it did not work.
Upvotes: 0
Views: 1133
Reputation: 44740
var pid = $(this).closest('ul').attr('id');
Upvotes: 1
Reputation: 2205
if($(this).closest("ul").attr("id") == "productmenu"){ }