jQuery UI sortable table handle

Diego picture Diego · Dec 17, 2010 · Viewed 22.5k times · Source

I'm having some difficults with sortable option handle.

When I use:

$("table tr").sortable().disableSelection();

There is no problem.

If I add the handle option then the sortable stops working:

$("table tr").sortable({
    handle: "td:eq(0)"
}).disableSelection();

The links:

http://jsfiddle.net/22C2n/

http://jsfiddle.net/22C2n/1/

Can anyone help me please?

Answer

mike picture mike · Dec 17, 2010

Wrap your <tr>'s in a <tbody> and change your code to:

$("table tbody").sortable({
    handle: 'td:first'
}).disableSelection();

You specify the container that contains the elements you want to be sortable not the actual elements...