Skip to content

How to identify the last item of a subRow array? #5621

Closed Answered by mauriciosoares
mauriciosoares asked this question in Q&A
Discussion options

You must be logged in to vote

Ended up solving this using just css, by selecting the row where the next item has a specific class, and added only in the parent row div that class... so the HTML structure would look like:

<div class="parent"></div>
<div class="subRow"></div>
<div class="subRow"></div>
<div class="parent"></div>
<div class="subRow"></div>
<div class="subRow"></div>

and used this simple snippet to select every row where the next element is a .parent:

:has( + .parent)

Also used last-child to make sure the very last item of the list also has the styles applied.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mauriciosoares
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant