I'm trying to create delete button which can remove elements in html code and which elements I created by jquery, but no luck. I thought the reason it's not working is because elements have not yet been added to the DOM, but I created a button with only function delete last child and it's work. My first delete button have animation properties. Look at this:
//Button add element to html code
$('#projects input:button').click(function(){
var name = $("#projects input:text").eq(0).val();
var link = $("#projects input:text").eq(1).val();
if (name === "") {
name = $("#projects input:text").eq(0).attr("placeholder");
}
if (link === "") {
link = $("#projects input:text").eq(1).attr("placeholder");
}
icon_place = '<img src="' + icon + '" alt="">';
if (icon === undefined) {
icon_place = '<img style="background-color: black">';
}
bg_place = 'background-image: url('+ bg +')';
if (bg === undefined) {
bg_place = 'background-color: red';
}
var ic4 = '<div class="item_card bg hover" style="'+ bg_place +'"><div class="delete"><img src="" alt=""></div><a href="' + link +'"></a>' + icon_place + '<span class="name">' + name + '</span></div>';
$('.column').append(ic4);
$('.delete').css('display','none');
if ( a % 2 != 0) {
a--;
$('#change').attr('value','Изменить');
}
});
//New delete button
$('#dl-other').click(function(){
$('.item_card').last().remove();
});
//My first delete button, it's work great with elements which in html code already been
$('.delete').click(function(){
var kek = $(this).parent();
kek.animate({opacity: 0, bottom: "+=16"}, 64).delay(128).hide(128, function(){ kek.remove()});
});