Reputation: 4865
I was wondering is there any way to get the last item in a unordered <ul>
list and place it at the top of the list...kind of like a continuous loop?
Sorry I'm a novice at JQuery
Any help is greatly appreciated, Thanks
Upvotes: 1
Views: 565
Reputation: 630389
You can use .prepend()
or .prependTo()
, like this:
$("#myUL li:last").prependTo("#myUL")
This uses :last
to get the last one them prepends it to the same list, inserting it at the beginning.
Upvotes: 4