I’m trying to populate featured with data then append it to #wrapper. This isn’t working for me. What am i doing wrong?
var featured = '<div id="featured"></div>';
$('#imageTable tbody tr td img').each(function(){
$(featured).append($(this).attr('src'));
});
$(featured).appendTo('#wrapper');
Explaination:
When you do this inside the loop
$(featured), it creates a NEW div for each selected element, so only the last div will be appended to your#wrapper. You need to create the jQuery object outside of theeachloop.