Hoa
Hoa

Reputation: 20438

Why doesn't my jQuery sortable table work?

I'm trying to follow

http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/

And have created a very simple example

http://jsfiddle.net/6wbZQ/

It's very straightforward and I'm stuck figuring out why my table is not sortable.

Upvotes: 0

Views: 711

Answers (1)

pjumble
pjumble

Reputation: 16960

You're doing:

<script>$("#sort tbody").sortable().disableSelection();</script>

before the table has been added to the document. Call sortable after the DOM has loaded:

<script>
$(function() {
    $("#sort tbody").sortable().disableSelection();
});
</script>

http://jsfiddle.net/6wbZQ/1/

Upvotes: 3

Related Questions