假设我们在HTML页面中有一个按钮。当我点击此按钮时,会加载第三方的其他HTML代码,我想删除一个组件:
<a component="post/edit" role="menuitem" tabindex="-1" href="#">
<span class="menu-icon"><i class="fa fa-pencil"></i></span> Edit
</a>
这是我的jQuery代码:
$(document).on('click', 'a[component="post/edit"]', function() {
var tid = 3;
socket.emit('plugins.connectschedulatopic.getTopic', { 'tid': tid }, function(err, topic) {
if (topic) {
if (Date.now() > topic.timestamp) {
console.log("FA FACALENDAR DA ELIMINARE");
// code is executed up to here but when execute the next line the program doesn't delete element
$('li[data-format="calendar"]').remove();
}
}
});
});
我认为这是一个加载问题。有人可以帮帮我吗?