I have data which are returned from my controller and thouse results are properly displayed as json inside js which appends div inside my view to show these data.
Now I have problem that with every click div is appended to +1 row to show same data.
How to delete these div on click action before appending new div.
success: function (result) {
var data = null;
$.each(result, function (i, item) {
data = '<div>' + item.Id + ' ' + item.Title + '</div>';
$("#tab-" + item.PropertyType).append(data);
});
Before you add a new set of divs you can delete all divs which have a parent div
whose name is starting with “tab-“