$('.negative').on('click',function() {
var saveImg = $(this).parents('.img_listing_long').find('img').clone();
$(list).append(saveImg);
});
If the element is already present in the list then it shouldn't be cloned.
$('.negative').on('click',function() {
var saveImg = $(this).parents('.img_listing_long').find('img').clone();
$(list).append(saveImg);
});
If the element is already present in the list then it shouldn't be cloned.
Update it:
$('.negative').on('click',function() {
if( $(list).find('img').length == 0 )
{
var saveImg = $(this).parents('.img_listing_long').find('img').clone();
$(list).append(saveImg);
}
});
Or put the class on img tag like class name "myimage" then:
$('.negative').on('click',function() {
if( $(list).find('.myimage').length == 0 )
{
var saveImg = $(this).parents('.img_listing_long').find('img').clone();
$(list).append(saveImg);
}
});