How to check if list is sortable?
I just found out, with the data-interface it is working too:
if ($( '#sortable' ).data( 'sortable' )) {
// sortable instance exists
}
There was a change in jQuery Version after 2012, so now you can write:
if ($( '#sortable' ).data( 'ui-sortable' )) {
// sortable instance exists
}
or
if ($( '#sortable' ).is(':ui-sortable')) {
// sortable instance exists
}
If the list is already sortable, then it should have class ui-sortable
.
You could use if ($('#list').hasClass('ui-sortable'))
to check it.