JSFiddle - React, Tailwind, and code Playground
by ravan
HTML
<input id="add" type="button" value="Add li" />
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
CSS
ul {
width: 300px;
}
ul li {
background-color: #536482;
}
ul li:nth-last-child(odd) {
background-color: #E0EBB2;
}
JavaScript
i = 6;
$('#add').click(
function () {
$("ul").append('<li>'+ i++ + '</li>');
}
);