Skip to main content

Bug Tracker

Side navigation

#7368 closed enhancement (invalid)

Opened November 01, 2010 01:04PM UTC

Closed December 02, 2010 08:08AM UTC

Last modified March 10, 2012 04:18AM UTC

Set index with index(number)

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: 1.5
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:

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.

Attachments (0)
Change History (5)

Changed November 01, 2010 08:30PM UTC by rwaldron comment:1

owner: → anonymous
status: newpending

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!

Changed November 01, 2010 08:31PM UTC by rwaldron comment:2

component: unfiledcore

Changed November 01, 2010 09:28PM UTC by anonymous comment:3

status: pendingnew

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.

I will work on additional usage examples soon if this one isn't sufficient enough.


Changed November 01, 2010 09:57PM UTC by snover comment:4

status: newpending

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?

Changed December 02, 2010 08:08AM UTC by trac-o-bot comment:5

resolution: → invalid
status: pendingclosed

Automatically closed due to 14 days of inactivity.