Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery sortable except this one

Need a way to allow sorting except for last item with in a list.

Tried using the cancel option but it didn't work and I don't think that's what its for.

I think a solution may be with events but would like your take on it.

In practice the list is dynamically generated and relies on tag and relative referencing not id's for selecting.

Sample code:

$("ul").sortable({});
...
<ul>
<li>red</li>
<li>blue</li>
<li>white</li>
<li>black</li>
<li>this li should not be sorted</li>
</ul>

Browser is Internet Explorer 6.

like image 841
jason saldo Avatar asked Nov 11 '08 22:11

jason saldo


1 Answers

$("ul").sortable( { items: "> li:not(:last)" } );
like image 65
Prestaul Avatar answered Oct 10 '22 01:10

Prestaul