我有一个<div>
我在其中添加 <table>
的标签通过 Javascript 动态地:
var htmlText = "<table id='table_" + id + "'><tbody>";
htmlText += "<tr> <td><img src='../../Icons/action_delete.gif' onclick='javascript:RemoveUser(\"" + id + "\");' /></td> <td>" + name + " </td></tr>";
htmlText += "</tbody></table>";
document.getElementById("divSearchUsers").innerHTML += htmlText;
我向 div 添加了多个表。现在我想删除一个特定的表。 我在RemoveUser函数中获取了表的ID。我该如何继续呢?
最佳答案
与非 jQuery 相关:
Remove dom element without knowing its parent?
function removeElement(el) {
el.parentNode.removeChild(el);
}
关于javascript - 从 <div> 标签中删除表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13873372/