I have an array that I want to have displayed in html.. I don\'t want to write multiple lines for posting each item in the array but all should be exactly the same. ie
Original from Sept. 13, 2015:
Quick and easy.
$.each(yourArray, function(index, value){
$('.element').html( $('.element').html() + '' + value +'')
});
Update Sept 9, 2019: No jQuery is needed to iterate the array.
yourArray.forEach((value) => {
$(".element").html(`${$(".element").html()}${value}`);
});
/* --- Or without jQuery at all --- */
yourArray.forEach((value) => {
document.querySelector(".element").innerHTML += `${value}`;
});