[英]Jquery Append on Click doesn't work. It instantly remove appended item
[英].remove() in jquery doesn't remove DOM instantly
我具有以下功能来删除DOM元素“ 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;
});
当我想遍历其余DIV更改其ID时,如何立即完全删除上面的DIV。
谢谢
将剩余的代码也放入渐变回调函数中。 异步执行的javascript语句,这就是获取元素的原因。 相反,您的元素将在1秒后删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.