Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

The element.parentNode Property

<div id="parent">
  <p id ="first-child">Some child text</p>
  <p id ="second-child">Some more child text</p>
</div>
<script>
  const firstChild = document.getElementById('first-child');
  firstChild.parentNode;  // reference to the #parent div
</script>
Source by www.codecademy.com #
 
PREVIOUS NEXT
Tagged: #The #Property
ADD COMMENT
Topic
Name
6+7 =