0

This is similar to many database problems where the best answer is "fix the schema!". I can if I must, but this is a pretty simple page where I'm 99% done and just trying to cross the finish line today.

The issue is that I have a flattened hierarchy of parents and children like this:

<tr class="parent-record">...<tr> <!-- has 3 children -->
<tr class="child-record">...<tr>
<tr class="child-record">...<tr>
<tr class="child-record">...<tr>
<tr class="parent-record">...<tr> <!-- has 0 children -->
<tr class="parent-record">...<tr> <!-- has 2 children -->
<tr class="child-record">...<tr>
<tr class="child-record">...<tr>

Now consider the following JavaScript/jQuery:

var parents = $('.parent-record');

parents.each(function () {
    var children = ???;
    // do something with children
});        

Is there a way to select ??? using the CSS/jQuery selection repertoire or is this necessarily going to require a javascript loop with appropriate logic to identify the correct elements?

Michael M.
  • 10,486
  • 9
  • 18
  • 34
BVernon
  • 3,205
  • 5
  • 28
  • 64

0 Answers0