[jQuery] Grouping within a list
I have an app which is producing a ul something like this:-
<ul>
<li class="green">grass</li>
<li class="green">trees</li>
<li class="blue">sky</li>
<li class="blue">sea</li>
<li class="yellow">sun</li>
<li class="yellow">banana</li>
</ul>
I want to create a group the items by the class and then enable
toggling of the group along the lines of:-
+ green
- blue
sky
sea
+ yellow
I guess my best solution is to create a nested list for each class. I
have some javascript that does more or less the same thing, but I'm
not sure how to identify each of the classes without iterating through
the whole lot in jQuery.