I want to append different classes to a set of repeating elements.
<div class="widget"></div>
<div class="widget"></div>
<div class="widget"></div>
<div class="widget"></div>
I want to style the above div elements by appending different style classes to them.
It should become like this
<div class="widget fg-white"></div>
<div class="widget fg-black"></div>
<div class="widget fg-red"></div>
<div class="widget fg-green"></div>
I know the direct CSS editing technique using jquery that is described here . But here, I want to append classes which already have the styles that I want.