带有 jqueryui 的可排序按钮

Sortable buttons with jqueryui

我尝试使用jquery-ui-sortable 对一些按钮进行排序。看: https://jsfiddle.net/k4kpfrcm/2/

<div id="sort">
    <button>test1</button>
    <button>test1</button>
    <button>test1</button>
</div>
$("#sort").sortable();

但它不起作用。 这有什么问题吗?

我怎样才能让它工作?

使用选项 cancel

$("#sort").sortable({cancel: ''});

因为 cancel 选项设置为 input,textarea,button,select,option 所以按钮不会处理可排序。

工作演示:https://jsfiddle.net/k4kpfrcm/3/