I am trying to remove a row which is actually in a DIV.
var html =
"<div class=\"product\" id=\"" +
                data.tasks[j].cart_id +
                "\"><div class=\"product-image\"><img src=\"images/albums/" +
                data.tasks[j].album_img +
                "\"></div><div class=\"product-details\"><div class=\"product-title\">" +
                data.tasks[j].song_name +
                "</div><div id=\"cart1\"></div></div><div class=\"product-price\">" +
                data.tasks[j].price +
                "</div><div class=\"product-quantity\"><input type=\"text\" value=\"2\" min=\"1\"></div><div class=\"product-removal\"><button class=\"remove-product\" onclick=\"removeItem1(" +
                data.tasks[j].cart_id +
                ")\">Remove</button></div><div class=\"product-line-price\">" +
                data.tasks[j].price +
                "</div></div>";
            $(html).appendTo("#cart1");
These are in a while loop. So it creates more than 1 row.
function for remove button is
function removeItem1(val) {
         //$(this).closest("div").remove();
        a = document.getElementById(val);
                        removeItem(a);
                    }
and in html I call the div by <div id="cart1"></div>
But when I click on the remove button all DIVs get removed. Not sure what I am doing wrong.
 
     
     
    