Reputation: 3
i would like to access li (id-67) via li (id-68)
i tried $("#68").parent('li').attr("id")
and $("#68").parent().parent('li').attr("id")
and could not grab the id 67.. Any idea thanks!
Upvotes: 0
Views: 396
Reputation: 3031
You could use jQuery.fn.parents()
to get to the closest parent li
:
$('#68').parents('li:eq(0)').attr('id');
Upvotes: 1