-2

我是 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>

有任何想法吗?

4

1 回答 1

0

要使用 rsWrap rsLastspacingWrapper 类删除最后一个元素,您可以这样做。

$(".rsWrap, .rsLastSpacingWrapper").last().remove();

要从每个表中删除它,您可以尝试(未经测试):

$('table').each(function(){
    $(".rsWrap, .rsLastSpacingWrapper").last().remove();
});

不太确定我的语法有多正确,但它至少应该让你知道从哪里开始。

于 2013-09-20T07:09:08.323 回答