Make an element sharing a class with other elements --- the last of them

In a content management system in which I generally don’t control the PHP, I have a sidebar with a dynamic number of PHP-derived elements: One, or two, or more.

I want to add a new element with JavaScript which would always be the last in the sidebar.

Given that all sidebar elements share the same class (sidebar-chunk).
How, based on that class, could I make that newly added element always last/bottomost in the sidebar?

You could do it without js and use css instead. Set the aside to display:flex, then set the display order of that class


I guess something like this is wanted:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.