newli.innerHTML = dynamicDropDown;
newli.insertBefore('#priceContainer');
完整代码:
newli = document.createElement('li');
var dynamicDropDown = '';
dynamicDropDown="<select>";
for(j=0; j<choiceArray.length; j=j+1){
dynamicDropDown+= "<option value='"+choiceArray[j]+"'>"+choiceArray[j]+"</option>";
}
dynamicDropDown += "</select>";
newli.innerHTML = dynamicDropDown;
newli.insertBefore('#priceContainer');