如何在createtextnode中添加1个以上的项目

时间:2016-10-13 04:01:19

标签: javascript cordova ionic-framework

我在这里有这个,我想知道的是什么 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);
      }
}

0 个答案:

没有答案