Skip to content

Instantly share code, notes, and snippets.

@boscomonkey
Created May 10, 2011 00:50
Show Gist options
  • Save boscomonkey/963740 to your computer and use it in GitHub Desktop.
Save boscomonkey/963740 to your computer and use it in GitHub Desktop.
JavaScript code to iterate over an array and add its item values to an ordered list and append to a div
function iterateOver(arry, div) {
var ol = $(document.createElement("ol"););
ol.class("records_list");
div.append(ol);
$.each(arry, function(i, item) {
ol.append("<li>" + item.value + "</li>");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment