I have a relatively complex list used as a product comparison table and need the list to be sortable by each of the list-items various attributes. Seems like this should be simple, but I haven't been able to get anything to work.
So I have something like this:
<ul id="myList">
<li id="item1">
<div class="myListTitle">Item 1</div>
<div class="myListPrice">
<span class="currency">£</span><span class="digits">12.45</span></div>
<div class="myListFirstFeature">456</div>
<div class="myListLastFeature"><span class="digits">36</span> options</div>
</li>
<li id="item2">
<div class="myListTitle">Item 2</div>
<div class="myListPrice">
<span class="currency">£</span><span class="digits">9.30</span></div>
<div class="myListFirstFeature">241</div>
<div class="myListLastFeature"><span class="digits">12</span> options</div>
</li>
<li id="item3">
<div class="myListTitle">Item 3</div>
<div class="myListPrice">
<span class="currency">£</span><span class="digits">17.25</span></div>
<div class="myListFirstFeature">842</div>
<div class="myListLastFeature"><span class="digits">64</span> options</div>
</li> </ul>
etc.
And then I want to have buttons that will order the list by the various attributes, ie
<button id="orderByPrice">Price</button>
<button id="orderByFirstFeature">1st Feature</button>
<button id="orderByLastFeature">Last Feature</button>
I hope that makes sense. Any help much appreciated.
Thanks