tegs89,
попробуйте так
var basket = {
var self = this;
};
basket.arr = [];
basket.add = function() {
$('.quantity').on('keyup', function(){
var id = $(this).attr('data-id');
var name = $(this).attr('data-name');
var img = $(this).attr('data-img');
var quantity = $(this).val();
$('.quantity').each(function(){
if($(this).val() > 0) {
var id = $(this).attr('data-id');
var name = $(this).attr('data-name');
var img = $(this).attr('data-img');
var quantity = $(this).val();
console.log(this.arr);
this.arr.push([id, name, img, quantity]);
}
})
$('#basket_title').nextAll().remove();
for(var i = 0; i < arr.length; i++) {
$('#basket_title').after('<div style="float:left"><input class="id_basket" type="hidden" value="' + arr[i][0] + '"><img style="width:60px" src="img/upload/' + arr[i][2] + '"><span>' + arr[i][1] + '<input style="width:40px" type="number" min="0" value="' + arr[i][3] + '"><img class="delete" style="width:25px" src="img/upload/delete.png"></div>');
}
console.log(arr);
})
}
basket.del = function() {
$(document).on('click', '.delete', function(e) {
//alert();
$(this).parent().parent().remove();
self.arr = [];
console.log(arr);
})
}