利用jquery删除当前行

[ 1775 查看 / 0 回复 ]

今天同事问的个问题,从网上找到的解决办法,jquery很强大

js: 

$(function() {
            $(".del").click(function() {
                $(this).parents("tr").remove();
            });
        })


html:

<table cellpadding="0" cellspacing="0" class="style1">
        <tr>
            <td>
                <input id="Button1" type="button" value="移除当前行" class="del"/>
            </td>
        </tr>
        <tr>
            <td>
                <input id="Button2" type="button" value="移除当前行" class="del"/>
            </td>
        </tr>
    </table>
1

评分次数

    TOP