Try this :-
$("#button").click(function () {
var clone = $("#container").find(".item").last().clone();
clone.attr("id","newId");
$("#container").append(clone);
});
0
solved Dynamically adding div on button click and changing Id of each?