在我的Meteor Project会话中设置映射函数数组返回CloneNode错误!代码在这里
var SubCategory = $(':checkbox[name=SubCategory]:checked').map(function() {
});
console.log(SubCategory);
Session.set( "subCategory", SubCategory);
和控制台输出
["category1", "category2", prevObject: jQuery.fn.init[2]]
控制台出错:Uncaught TypeError: elem.cloneNode is not a function
答案 0 :(得分:1)
我已经解决了这个问题。
SubCategory(event){
let checked = event.target.checked;
let subcategory= [];
var SubCategory = $(':checkbox[name=SubCategory]:checked').map(function(value,index) {
subcategory.push(index.value);
});
Session.set( "subCategory", subcategory);
}
控制台中的结果:
["category1", "category2"]