aooga Posted June 29, 2009 Share Posted June 29, 2009 HTML: <span id="top"> <span id="bottom"> </span> </span> If my javascript script starts with "bottom", is there a function to get it's immediate ancestor, in this case "top"? Link to comment https://forums.phpfreaks.com/topic/164133-how-can-i-find-the-parent-id/ Share on other sites More sharing options...
rhodesa Posted June 29, 2009 Share Posted June 29, 2009 var ele = document.getElementById('bottom'); var parent_id = ele.parentNode.id; Link to comment https://forums.phpfreaks.com/topic/164133-how-can-i-find-the-parent-id/#findComment-865828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.