I have five HTML li elements. Let's say if the 3rd li element has the active class, then I want the 1st and 2nd li element to have class complete. First remove the class whatever 1st and 2nd li element has, then add the class complete.
If the 3rd li element has class name active, then the 4th li element should have half-complete class name. The last li element should have nothing.
<ul>
<li class="complete">Coffee</li>
<li class="complete">Tea</li>
<li class="active">Milk</li>
<li class="hafl-complete">Milk</li>
<li>Milk</li>
</ul>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…