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
You should use $.map for this:
$.map
var array = ["one", "two", "three"]; var el = $.map(array, function(val, i) { return "" + val + ""; }); $(".element").html(el.join(""));
jsFiddle demo