删除嵌套div中的表的最后一行

时间:2013-08-23 14:47:09

标签: html jquery-selectors removechild

我想删除最后一行。

我在div中潜水,它有桌子和很多行。

我想删除表的最后一行。我无法迭代到最后一次。

  <div class="span15" id="MURWorksheetPage2">
                <div class="span8">
                    <table>
                        <tr>
                            <td class="col1">
                                @Html.DisplayNameFor(model => model.MedicineUseNo) @Html.TextBoxFor(model => model.MedicineUseNo, new { id = "txtMedicineUseNo", style = "Width:20px" })

                            </td>
                            <td class="col2">@Html.DisplayNameFor(model => model.MedicinePrescribed) @Html.TextBoxFor(model => model.MedicinePrescribed, new { id = "txtMedicinePrescribed" })</td>
                        </tr>
                        <tr>
                            <td class="col1" colspan="2">
                                @Html.DisplayNameFor(model => model.OTC)  @Html.TextBoxFor(model => model.OTC, new { id = "txtOTC" })

                            </td>
                        </tr>
 </table>
                </div>
            </div>

1 个答案:

答案 0 :(得分:0)

未经测试,但这应该有效。

$('#MURWorksheetPage2 div table :last').remove();