JSFiddle - React, Tailwind, and code Playground
by KyleMuir
HTML
<div id="children">
<ul></ul>
</div>
JavaScript
var r = {
results: [{
image: 'hello',
name: 'whatever',
id: 1
}]
};
$.each(r.results, function (i, item) {
$tpl = '<li item-id=' + item.id + '>';
$tpl += '<figure>';
$tpl += '<img src="' + item.image + '" alt="' + item.name + '">';
$tpl += '</figure>';
$tpl += '</li>';
$('#children ul').append($tpl);
});