<body>
<input type="text" id="search" onchange="doSearch()" />
<div id="catalog">
</div>
<div id="each_track">
</div>
<script>
SC.initialize({
client_id: '*****************'
});
function doSearch() {
var searchTerm = document.getElementById('search').value;
// Search soundcloud for artists
SC.get('/tracks', { q: searchTerm, license: 'cc-by-sa' }, function(tracks) {
for(track in tracks) {
var img = document.createElement('img');
var catalog = document.getElementById('catalog');
img.setAttribute("src",tracks[track]["artwork_url"]);
catalog.appendChild(img);
}
}
});
};
</script>
</body>
Just append a div to each img rather than all the images to the div, in response to the comments.