JAVASCRIPT
for (var i = 0; i < surveyResults.resultsOfSurvey.length; i = i + 1) {
debugger;
var answer = surveyResults.resultsOfSurvey[i].correct;
var qId = surveyResults.resultsOfSurvey[i].id;
var newElement = document.createElement('div');
newElement.id = surveyResults[i];
newElement.className = "answer";
newElement.innerHTML = "Antwort ist: " + answer + "! Fragen ID ist: " + qId + ".";
document.body.appendChild(newElement);
}
HTML
<div id="contentForSurvey">
<div id="answers"></div>
如何将循环中的 div 插入for
到 div 中id="answers"
?