jQuery的从TR删除备用TD [英] jquery to delete alternate td from a tr

查看:164
本文介绍了jQuery的从TR删除备用TD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们!
我在tr中有备用的空tds,想从td中删除其完整的标记,就像

dear friends!
i have alternate empty tds in a tr ,want to remove their complete markup from td,are like

<table><tbody><tr class="EffectiveRow">
<td class="GridItemStyle" style="width:30px;text-align:center;">
<table><tbody><tr><td class="ExtraPadding" style="width:48px;text-align:center;">748</td></tr></tbody></table>
<table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td class="GridItemStyle" style="width:0px;"></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table>
<table><tbody><tr><td class="GridItemStyle" style="width:98px;text-align:center;">Better Homes LLC</td></tr></tbody></table>
<table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td class="GridItemStyle" style="width:0px;"></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table>
<table><tbody><tr><td class="GridItemStyle" style="width:50px;text-align:center;">4.2</td></tr></tbody></table>
<table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td class="GridItemStyle" style="width:0px;"></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table>
<table><tbody><tr><td class="GridItemStyle" style="width:142px;text-align:center;">Map icon on unit detail page</td></tr></tbody></table>
<table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td class="GridItemStyle" style="width:0px;"></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table>
</td></tr></tbody></table>


想要使用任何jquery方法,有些人可以帮助我这样做


want to go for any jquery approach,some body help me to do so

$(".EffectiveRow").html().replace('<table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td class="GridItemStyle" style="width:0px;"></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table>','');


在此先感谢


thanks in advance

推荐答案

(" ).html().replace(' < table>< tbody>< tr>< table< tbody< tr>< table> tbody< tr>< table> tbody< tr< table< tbody< tr< t> td类="GridItemStyle" style ="width:0px;"></td></tr></tbody</table></tr></tbody></table>< ;/tr</tbody</table</tr</tbody</table</tr</tbody</table>'/span>, ' ');
(".EffectiveRow").html().replace('<table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><table><tbody><tr><td class="GridItemStyle" style="width:0px;"></td></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table></tr></tbody></table>','');


在此先感谢


thanks in advance


如果有任何意义(我对此加倍,请参阅我对问题的评论),我建议使用直接的DOM操作代替无结构的替换: http://api.jquery.com/category/manipulation/dom-removal [
—SA
If it made any sense (which I double, please see my comment to the question), I would advise to use, instead of stuctureless replace, direct DOM manipulations: http://api.jquery.com/category/manipulation/dom-removal[^].



As Kornfeld Eliyahu Peter correctly pointed out, your HTML is absolutely invalid, so first, you need to address it: how did you get that invalid HTML in first place? When I say "if it made any sense", I meant that your request does no seem to make any practical sense.

—SA


这篇关于jQuery的从TR删除备用TD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆