Ticket #7368 (closed enhancement: invalid)
Set index with index(number)
| Reported by: | anonymous | Owned by: | anonymous |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.5 |
| Component: | core | Version: | |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
It would be nice if the index() method allowed you to set the index of the current element(s) also; currently you can only get the index of the first element relative to its siblings. index(0) would move all the elements before their siblings and index(-1) would move all elements after their siblings. And it would be even better if it wrapped, so that if there's three elements and you did index(3), it would place the element at the start.
Change History
comment:3 Changed 3 years ago by anonymous
- Status changed from pending to new
Here's a simple example with jsFiddle of how you could use this to easily be able to move elements with a couple of controls. http://jsfiddle.net/Pzpzr/
I will work on additional usage examples soon if this one isn't sufficient enough.
Thanks!
comment:4 Changed 3 years ago by snover
- Status changed from new to pending
You can already do this very easily using .next, .previous, .after, and .before, as per this example. Could you please provide a novel use case?
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Thanks for taking the time to contribute to the jQuery project! Please provide a jsFiddle that outlines practical use cases for your enhancement request.
Additionally, test against the jQuery 0 GIT version to ensure the issue still exists. Be Excellent to eachother!