JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
</ul>

CSS

li {
    width: 50%;
    height: 2em;
    display: list-item;
}

li:nth-child(odd) {
    background-color: red;
}

li:nth-child(even) {
    background-color: orange;
}

JavaScript

$('ul').empty();