I have an array called desc, which contains some text for each of its values and changes the length and values depending on what the user clicks on.
array:
desc[0] = "manhole cover on foothpath on barrog gaa grounds kilbarrack road loose." desc[1] = "Footpath at driveway to 17 Maywood Lawn in bad state of disrepair."
I would like to display these array values in a div called #container. At the moment, it just prints the last value of the array in #container, and does not print each of the values in the list.
JavaScript:
function incidentList(){ for(var i=0; i<desc.length; ++i){ $("#container").text(desc[i]); } }
Html:
<div id="container" style="width: 50%; height:97%; float:right;"></div>
How should I print a complete list with each array value under the last using a loop?
wtmcm source share