我是Ajax和Stack Overflow的新手(即使我读了很多帖子)。
我需要删除表格中的元素(class="rsWrap rsLastSpacingWrapper">
),以防有多个元素具有相同的<td>
标记。
<table class="rsTimelineTable" cellspacing="0" cellpadding="0" border="0" style="border-right:0px none;">
<tbody>
<tr class="rsAllDayRow">
<td class="rsAllDayCell">
<div class="rsWrap rsLastSpacingWrapper"> </div> <!--DO NOT DELETE -->
</td>
<td class="rsAllDayCell">
<div class="rsWrap rsLastSpacingWrapper"> </div> <!--DO NOT DELETE -->
</td>
<td class="rsAllDayCell">
<div class="rsWrap" style="z-index:7;">
<div id="ctl00_M_RadScheduler1_82_0" class="rsApt rsFlownDay" style="height:100%;width:100%;" title="17.10"></div>
<div class="rsWrap rsLastSpacingWrapper"> </div> <!TO DELETE -->
</td>
<!-- Other TD tag>
</tbody>
</table>
<table class="rsTimelineTable" cellspacing="0" cellpadding="0" border="0" style="border-right:0px none;">
<tbody>
<tr class="rsAllDayRow">
<td class="rsAllDayCell">
<div class="rsWrap rsLastSpacingWrapper"> </div> <!--DO NOT DELETE -->
</td>
<td class="rsAllDayCell">
<div class="rsWrap rsLastSpacingWrapper"> </div> <!--DO NOT DELETE -->
</td>
<td class="rsAllDayCell">
<div class="rsWrap" style="z-index:7;">
<div id="ctl00_M_RadScheduler1_82_0" class="rsApt rsFlownDay" style="height:100%;width:100%;" title="17.10"></div>
<div class="rsWrap rsLastSpacingWrapper"> </div> <!-- TO DELETE -->
</td>
<!-- Other TD tag>
</tbody>
</table>
<table class="rsTimelineTable" cellspacing="0" cellpadding="0" border="0" style="border-right:0px none;">
<!-- etc etc -->
</table>
有什么想法吗?
答案 0 :(得分:0)
要使用rsWrap rsLastspacingWrapper类删除最后一个元素,您可以这样做。
$(".rsWrap, .rsLastSpacingWrapper").last().remove();
要从每个表中删除它,您可以尝试(未经测试):
$('table').each(function(){
$(".rsWrap, .rsLastSpacingWrapper").last().remove();
});
不太确定我的语法有多正确,但它至少应该让你知道从哪里开始。