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"? Quote Link to comment 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; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.