Forum Discussion
Manipulating the Player Menu with Javascript
And rereading your post...its even simpler.
This will select all nth-children...li:nth-child(n)
var targetList = "#outline-content > ul > li > ul > li:nth-child(n) > div"
switchStyle(targetList);
function switchStyle( _targetList ){
var targetNodeList = document.querySelectorAll(_targetList);
for(var i=0; i <= targetNodeList.length;i++){
var el = targetNodeList[i];
//doSomething for all using a terniary operator as if/else check
el.style.display === "none" ? (el.style.display = "flex") : (el.style.display = "none");
}
}
So 2 methods now in this Storyline to achieve it.
And here you find some great info on selectors for nth-child...
https://css-tricks.com/useful-nth-child-recipies/
Bonus of this approach is you donot need to worry about amount of menu list items.
Kind regards,
Math