删除元素的父行

Fir*_*orm 2 javascript jquery html-table

我有一个在单元格中有按钮的表,如下所示:

<table>
    <tr>
        <td>information</td>
        <td>
            <button onclick="function(id, this)">Text</button>
        </td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

按下按钮时调用的函数会执行一些ajax操作,如果成功,则应从DOM中删除按钮所在的整行.(这是一个删除功能;)

但是,我似乎无法让jQuery删除正确的行.我已经习惯了$('#id').parent().parent().remove();,因为我认为它会:按钮 - >单元格 - >行,但它只是删除了表格的第一行?!哪里输了?:(

Smo*_*PHP 10

http://jsfiddle.net/ZnX5J/

<table>
    <tr>
        <td>information</td>
        <td>
            <button onclick="removeRow(this)">Text</button>
        </td>
    </tr>
    <tr>
        <td>blah</td>
        <td>
            <button onclick="removeRow(this)">Text</button>
        </td>
    </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

JavaScript的

removeRow = function(el) {
    $(el).parents("tr").remove()       
}
Run Code Online (Sandbox Code Playgroud)