Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function getList(item, $list) {
if($.isArray(item)) {
$.each(item, function (key, value) {
getList(value, $list);
});
return;
}
if (item) {
var $li = $('<li />');
if (item.name) {
$li.append($("<p style='margin-bottom:0px'>"+item.name+"</p>"));
}
if (item.errors && item.errors.length) {
var $sublist = $("<ul/>");
getList(item.errors, $sublist)
$li.append($sublist);
}
$list.append($li)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.