Is it possible to order a group of Div’s by id or class using jQuery? Here’s my code:
<div id="product_categories">
<div class="wpsc_categorisation_group" id="categorisation_group_49">
<a href="http://africa.local/store/african-dolls/">African Dolls</a>
</div>
<div class="wpsc_categorisation_group" id="categorisation_group_47">
<a href="http://africa.local/store/anklets/">Anklets</a>
</div>
<div class="wpsc_categorisation_group" id="categorisation_group_5">
<a href="http://africa.local/store/bracelets/">Bracelets</a>
</div>
<div class="wpsc_categorisation_group" id="categorisation_group_11">
<a href="http://africa.local/store/childrens-jewelry/">Children's Jewelry</a>
</div>
<div class="wpsc_categorisation_group" id="categorisation_group_13">
<a href="http://africa.local/store/clearance/">Clearance</a>
</div>
<div class="wpsc_categorisation_group" id="categorisation_group_8">
<a href="http://africa.local/store/cross-necklaces/">Cross Necklaces</a>
</div>
</div>
I know the code is kind messed up but WP E-Commerce is generating it and won’t allow me to order it the way I want. Any thoughts?
Thanks.
I came up with a rough draft. This code can most likely be cleaned up a lot, but here you go
Demo : http://jsfiddle.net/3paUL/
How it works : It looks at the IDs of the DIV elements inside and sorts them. Since all your DIV elements follow the pattern of an
_and a number, I take off that number and use that as the index.