0

I am adding a button with every list item here.

$(".show").click(function(){
    var list="";
    
    for(var i=0;i<contacts.length;i++)
    {   
       list=list+"<li>"
       +"Name: "+contacts[i][0].value+" "+contacts[i][1].value+"<br>"
       +"Phn: "+contacts[i][2].value+"<br>"
       +"Address: "+contacts[i][3].value+"<br>"
       +"<button>Delete</button>" 
       +"</li>";
       
    }
    $(".contactsList").append(list);
    
});

triggering this button here,

$("button").click(function(){
    
        console.log(78);
        $(this).parent().remove();

    }
);

But the click function is not calling?

orphius
  • 37
  • 5

0 Answers0