Using jQuery, I am adding HTML code to a div. One part of this code involves referencing a div's ID by concatenating a variable from a loop.
$(... +
'<div class="recommendations filter" id="recCards-'+ i +'">' +
'<div><h5>Recommended Cards</h5></div>' +
'<ul></ul>' +
'</div>' +
...
).appendTo('.someDiv');
Next, I am attempting to append code from another loop into the ul by using the ".recommendations" div's ID in the following manner...
var recCardsList = $(div).attr('id', '.recCards-'"+i+"' ul');
$('<div>'+recCardName+'</div>').appendTo(recCardsList);
I have experimented with various quotation mark combinations, but have been unsuccessful in selecting the div correctly for appending new content.