如何从表格单元格中删除html的某些部分

How to remove some part of html from a table cell

本文关键字:html 些部 删除 表格 单元格      更新时间:2024-05-19

我有一个表,其中包含具有以下html内容的列的所有单元格:

<span id='"" + id + "'"" + "class='"asset_value'">" + comments + "</span>" + "<span class='"glyphicon glyphicon-pencil pull-right'">&nbsp;</span>

如何删除onclick事件上的<span class='"glyphicon glyphicon-pencil pull-right'">&nbsp;</span>

我已经有一个onclick事件函数,其中有行id和列id,其中有这个单元格。

试试这个:

$(this).closest("tr").find("span.glyphicon").remove();

Try,

$(this).parent().find(".glyphicon").remove();