JSFiddle - React, Tailwind, and code Playground

by Roko

HTML

<ul>
    <li id="hide1">hide1</li>
    <li id="show2">show2 is the only visible</li>
    <li id="hide3">hide3</li>
</ul>

JavaScript

var liHide = document.querySelectorAll("[id^=hide]");

for(var i=0; i<liHide.length; i++){
   // do someghing with liHide[i] like:
   liHide[i].style.display = "none";
}