I want to be able to select all siblings past a certain element, like this:
<ul>
<li>Unselected</li>
<li>Unselected</li>
<li id="start">Start Here</li>
<li>Selected</li>
<li>Selected</li>
<li>Selected</li>
</ul>
I cannot plan for the amount of siblings to select or the number at which it will start, so I'm guessing that there will need to be a .length in there at some point.
Vanilla JS only please :) Thanks!
You can select those elements by using ~ selector,
var elems = document.querySelectorAll("#start ~ li");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With