gpt4 book ai didi

javascript - Jquery 嵌套排序 : Uncaught TypeError: Cannot read property 'match' of undefined

转载 作者:行者123 更新时间:2023-11-30 15:31:06 26 4
gpt4 key购买 nike

这是 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

关于javascript - Jquery 嵌套排序 : Uncaught TypeError: Cannot read property 'match' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42229742/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com