JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html>
<head>
 
</head>
    <body>
        <div>
            <ul id="filterlist">
                <li>John</li>
                <li>Karl</li>
                <li style="display:none">Brandon</li> 
                <li>Sam</li>     
                <li>Glen</li>
                <li>Tane</li>
                <li>Ralph</li>
                <li>David</li>                
            </ul>
        </div>      
    </body>
</html>

CSS

div { float:left; }
span { color:blue; }

JavaScript

$(function() {
    $("ul#filterlist li:visible").filter(function(index) {
        return (index + 1) % 3 == 0 ? true : false;
    }).css("color", "red");
});