I have this html product code:
<div id="new-product-content">
<div class="col-md-3 col-sm-6 col-xs-12">
// here code product
<div class="delete-product">
<a>Detele</a>
</div>
</div>
</div>
<div id="products-div">
JQuery Code:
$(document).ready(function() {
var i = 0;
$('.add-new-product').on('click', function() {
// here just clone the product when chick on (.add-new-product) button
// every thing is fine with clone
var $clone = $('#new-product-content > div').clone();
$clone.appendTo('#products-div');
i++;
// here I try to put id in each product
$('#new-product-content > div').attr('id', 'row'+ i);
// here to put id in
$('.delete-product > a').attr('id',i);
});
});
Here in jQuery code I clone the product in many times, then put the id for each product, and put the same id for delete button that he can delete it if he wish.
So what I need to delete product after he add it ?