Reputation Activity
-
danskkr reacted to Skateside in Sort list dynamicallyPHP or some other server-side language is definitely the best approach.
However, if you have to use JavaScript, there are a few steps you need to go through:
Create an array using the values of the list.
Sort the array.
Remove all the current list items from the list.
Recreate the list items in the new order.
It's complicated, but not impossible. I've created a demonstration of how to do it. Take a close look at the syntax and feel free to ask if anything doesn't make sense:
Demonstration