.remove jquery不起作用


.remove jquery not working

如果我有超过2<,我有这个简单的jquery代码;。tr><tr>标记我想删除second<内的td.checkout类;。tr>行。

jquery代码:

$(document).ready(function() {
    var count = $(".mini-cart-total > table > tbody > tr").length;
    if (count > 2 ) {
        $(".mini-cart-total > table > tbody > tr:nth-child(2) > td.checkout").remove();
    }
});

我的html/php结构如下:

<div class="mini-cart-total">
  <table>
    <?php foreach ($totals as $total) { ?>
    <tr>
      <td class="right"><b><?php echo $total['title']; ?></b></td>
      <td class="right"><?php echo $total['text']; ?></td>
      <td class="checkout"><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></td>        
    </tr>
    <?php } ?>
  </table>
</div>

由于某些原因,我无法获得此工作

$(".mini-cart-total .checkout").remove();