I’m trying to add results from an object to newly created HTML elements:
*long chain of newly created elements*.append(
$("<div />").append(
$.each(myObj.results, function( intIndex, objValue ){
return objValue.description;
})
)
);
If I use a function() call with a for-loop instead of each() it works, but is there no way to achieve this with each()?
.eachis meant for iterating over the list and perform operation, You can achieve what you want with $.map Which build an array from returned elements in each iteration.