Get nested parent HREF node - Javascript DOM

Javascript examples for DOM:Element parentNode

Description

Get nested parent HREF node

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*w w w. jav  a 2 s. co  m*/
var href = document.getElementById('some_div').parentNode;
console.log(href)
    }

      </script> 
   </head> 
   <body> 
      <a href="http://java2s.com"> 
         <div id="some_div"> 
            <span class="some_class"> 
               <img src="http://www.java2s.com/style/download.png"> 
            </span> 
         </div> 
      </a>  
   </body>
</html>

Related Tutorials