I have the following function to remove a DOM element “div”,
$('#emDiv').on("click", ':button[data-emp-del="true"]', function (evt) {
evt.preventDefault();
// Get Row - "emp0" or "emp1" etc ...
var rowId = "#" + $(this).data('emp-id');
// Remove the DIV
$(rowId).fadeOut('normal', function () {
$(this).remove();
});
// The results below returns even the one that was removed
// $('div[id^="emp"]')
return false;
});
How to completely remove the DIV above instantly as I want to loop over remaining DIVs change their IDs.
Thanks
Put the remaning code also in the fadeout callback function. The javascript statements executed asynchronosly thats why you get the element. Instead your element get deleted after 1 second.