Skip to main content

What would be the most efficient method be to find a child element of (with class or ID) of a particular parent element using pure javascript only. No jQuery or other frameworks.

In this case, I would need to find child1 or child2 of parent, assuming that the DOM tree could have multiple child1 or child2 class elements in the tree. I only want the elements of parent

<div class="parent"> <div class="child1"> <div class="child2"> </div> </div> </div> 

What would the most efficient method be to find a child element of (with class or ID) of a particular parent element using pure javascript only. No jQuery or other frameworks.

In this case, I would need to find child1 or child2 of parent, assuming that the DOM tree could have multiple child1 or child2 class elements in the tree. I only want the elements of parent

<div class="parent"> <div class="child1"> <div class="child2"> </div> </div> </div> 

What would be the most efficient method to find a child element (with class or ID) of a particular parent element using pure javascript only. No jQuery or other frameworks.

In this case, I would need to find child1 or child2 of parent, assuming that the DOM tree could have multiple child1 or child2 class elements in the tree. I only want the elements of parent

<div class="parent"> <div class="child1"> <div class="child2"> </div> </div> </div> 

What would the most efficient method be to find a child element of (with class or ID) of a particular parent element using pure javascript only. No jQuery or other frameworks.

In this case, I would need to find child1 or child2 of parent, assuming that the DOM tree could have multiple child1 or child2 class elements in the tree. I only want the elements of parent

 <div class="parent">   <div class="child1">   <div class="child2">   </div>   </div>  </div> 

What would the most efficient method be to find a child element of (with class or ID) of a particular parent element using pure javascript only. No jQuery or other frameworks.

In this case, I would need to find child1 or child2 of parent, assuming that the DOM tree could have multiple child1 or child2 class elements in the tree. I only want the elements of parent

 <div class="parent">   <div class="child1">   <div class="child2">   </div>   </div>  </div> 

What would the most efficient method be to find a child element of (with class or ID) of a particular parent element using pure javascript only. No jQuery or other frameworks.

In this case, I would need to find child1 or child2 of parent, assuming that the DOM tree could have multiple child1 or child2 class elements in the tree. I only want the elements of parent

<div class="parent"> <div class="child1"> <div class="child2"> </div> </div> </div> 
edited title
Link
isherwood
  • 61.4k
  • 16
  • 122
  • 173

Finding child element of parent pure javascriptwith JavaScript

Source Link
Blyde
  • 3.2k
  • 2
  • 20
  • 16
Loading