这是我的jsfiddle
http://jsfiddle.net/tdzfhzjy/24/
单击删除按钮后,我试图删除当前的 jquery 可折叠 div 。
事件正在被捕获,但当前的 jquery collapsable 没有被删除
这是我的代码,你能让我知道如何删除当前的 jquery 可折叠吗?
document.addEventListener('click', function(event) {
if ($(event.target).is('.labelDelIcon')) {
$(this).closest('#data').remove();
event.stopPropagation();
}
}, true // Capture event
);
请问如何删除当前的 jquery data-role="collapsible"
最佳答案
使用 class
而不是 Id
,然后尝试以下操作:
document.addEventListener('click', function(event) {
if ($(event.target).is('.labelDelIcon')) {
$(event.target).closest('.data').remove()
event.stopPropagation();
}
}, true // Capture event
);
Note: $(this) is current object here refers to the Document I have used $(event.target) for currect object.
关于javascript - 如何删除jquery可折叠数据角色="collapsible",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28318768/