Jquery nestedSortable: Uncaught TypeError: Cannot read property 'match' of undefined

Jquery nestedSortable: Uncaught TypeError: Cannot read property 'match' of undefined

这是fiddle:https://jsfiddle.net/107bx70o/3/

var ns = $('ol.sortable').nestedSortable({
    forcePlaceholderSize: true,
    handle: 'div',
    helper: 'clone',
    items: 'li',
    opacity: .6,
    placeholder: 'placeholder',
    revert: 250,
    tabSize: 25,
    tolerance: 'pointer',
    toleranceElement: '> div',
    maxLevels: 3,
    isTree: true,
    expandOnHover: 700,
    startCollapsed: false,
    change: function() {
        console.log('change');
    },
    sort: function() {
        console.log('sort');
    },
    relocate: function() {
        console.log('relocate');
    }
});

$('#toArray').click(function(e) {
    arraied = $('ol.sortable').nestedSortable('toArray', {startDepthCount: 0});
})

单击按钮时,出现错误。

我也试过 github 上的最后一个版本:https://github.com/ilikenwf/nestedSortable

但是错误是一样的。我的代码与 Fiddle.

完全一样

您只是错过了将 ids 设置为 li menu ,

<li id="menuItem_1"> ....</li>

这是一个作品 Fiddle