0
我正面臨一個小問題。當我在Google Chrome瀏覽器中右鍵單擊該頁面並按檢查(頁面的源代碼)時,出現以下錯誤。這個文件(ui-nestable.min.js)是我的頁面正常工作所需的,它的有趣的一面是我的頁面正常工作。我在互聯網上進行了研究,但沒有發現此錯誤的任何結果。未捕獲TypeError:無法讀取屬性'val'的undefined(ui-nestable.min.js)
UI-nestable.min-JS代碼:
var UINestable = function() {
var updateOutput = function (e) {
var list = e.length ? e : $(e.target),
output = list.data('output');
if (window.JSON) {
output.val(window.JSON.stringify(list.nestable('serialize'))); //, null, 2));
} else {
output.val('JSON browser support required for this demo.');
}
};
return {
//main function to initiate the module
init: function() {
// activate Nestable for list 1
$('#nestable_list_1').nestable({
group: 1
})
.on('change', updateOutput);
// activate Nestable for list 2
$('#nestable_list_2').nestable({
group: 1
})
.on('change', updateOutput);
// output initial serialised data
updateOutput($('#nestable_list_1').data('output', $('#nestable_list_1_output')));
updateOutput($('#nestable_list_2').data('output', $('#nestable_list_2_output')));
$('#nestable_list_menu').on('click', function (e) {
var target = $(e.target),
action = target.data('action');
if (action === 'expand-all') {
$('.dd').nestable('expandAll');
}
if (action === 'collapse-all') {
$('.dd').nestable('collapseAll');
}
});
$('#nestable_list_3').nestable();
}
};
}();
jQuery(document).ready(function() {
UINestable.init();
});
此線'output.val(window.JSON.stringify(list.nestable( '序列化'))); //,null,2))'沒有找到數據,所以它是空的 – Saif