我在这里有这个,我想知道的是什么
document.createTextNode(addLocation.name);
如何添加多个项目?例如,如果我这样做,它会工作吗?
document.createTextNode(addLocation.name, addLocation.description)
?
function locationcardload(){
var allLocations = document.getElementById("locationList");
;
rawTxt = localStorage.getItem("locations")
LocationArray = JSON.parse(rawTxt);
;
for (var x=0; x<LocationArray.length; x++) {
var addLocation = LocationArray[x];
var additem = document.createElement("div")
additem.classname = "icon";
additem.className = "item";
;
var LocListText = document.createTextNode(addLocation.name);
additem.appendChild(LocListText);
allLocations.appendChild(additem);
}
}