html
<ul class="logoUl">
<li class="orange"></li>
<li class="blue"></li>
<li class="green"></li>
<li class="pink"></li>
</ul>
SCRIPT
if (selectedCategory == 'currentAll') {
var strString = "orange,blue,green,pink";
var strArray = strString.split(',');
$.each(strArray, function (index, value) {
$("ul.logoUl > li").addClass(value)
});
}
Within the ul element with the class logoUL, there are four list items representing an image. Occasionally, these list items may receive background colors which override their original color scheme.
Unfortunately, my current code fails to revert these colors back to their initial state if they have been altered.
Question:
Is there a way to loop through each list item individually and add one class at a time in order to restore the original color scheme of the image?