Reputation: 679
I want to draw multiple lines that contains infos on a product for the exemple lets say its name. I declare the variable at the beginning of my function :
I iterate through a list of product :
var productName = '<div class="productName"></div>';
for (var i = 0; i < context._model._productsList.length; i++) {
var productLine = '<div data-id="' + i + '" class="productLine"></div>';
$('#boardProducts').append(productLine);
$('[data-id="' + i + '"]').append(productName);
For each product i would like to wrap product name inside the related product name div.
But if i select $('.productName').append('A name');
it'll select all div productName.
Is there a way to append in the last productName div i did append ?
Upvotes: 2
Views: 49