当我使用下面的代码时,我收到一条错误消息,我已经看过类似的问题,他们都说我必须尝试插入一个不能去的元素节点,但是我看不出是什么做错了。
function cutSelect(){
$.each(fibre, function(i, carpet){
if(carpet.weave == 'Cut'){
pile.push(carpet);
}
});
document.getElementById("weaveSelect").style.display = "none";
$.each(pile, function(i, carpet){
place = document.getElementById("displayDiv");
imgLink = document.createElement("a");
img = document.createElement("img");
br = document.createElement("br");
name = document.createElement("a");
price = document.createElement("p");
extra = document.createElement("p");
imgLink.href = carpet.link;
img.src = carpet.photo;
img.style.width = "300px";
img.style.height = "300px";
img.style.padding = "20px, 20px, 10px, 20px";
imgLink.appendChild(img);
name.href = carpet.link;
name.innerHTML = carpet.name;
price.innerHTML = "£" + carpet.price + "m2";
extra.innerHTML = carpet.extra;
place.appendChild(imgLink);
place.appendChild(br);
place.appendChild(name);
place.appendChild(price);
place.appendChild(extra);
});
}
希望有人可以对这个问题有所了解。