I am trying to create a checklist that will sort the marked items at the top of the list, and when the item is not checked, it will move below the marked items. In addition to the check / unchecked appearance, the elements must remain in the original order, regardless of the order in which they are checked.
In other words, a list of five items should always look like this:
* two
* three
one
four
five
Not this:
* three
* two
one
four
five
I saw examples of moving clicks of elements to a specific position in the list, but nothing takes into account the state of other elements in the list.
Ideally, I would also like to enliven the transition. Also, is there a way to remember the checked state across multiple pages?
This is the HTML I'm starting with:
<form> <ul> <li><label for="one"><input type="checkbox" id="one" />One</label></li> <li><label for="two"><input type="checkbox" id="two" />Two</label></li> <li><label for="three"><input type="checkbox" id="three" />Three</label></li> <li><label for="four"><input type="checkbox" id="four" />Four</label></li> <li><label for="five"><input type="checkbox" id="five" />Five</label></li> </ul> </form>
source share