2013-11-15 53 views
1
<table id="personal" border="1"> 
    <tr> 
    <td>Name</td> 
    <td>Address</td> 
    <td rowspan="2" class="remove">Remove</td> 
    </tr> 
    <tr> 
    <td>Name</td> 
    <td>Address</td> 
    </tr> 
    <tr> 
    <td>Name</td> 
    <td>Address</td> 
    <td rowspan="2" class="remove">Remove</td> 
    </tr> 
    <tr> 
    <td>Name</td> 
    <td>Address</td> 
    </tr> 
    <tr> 
    <td>Name</td> 
    <td>Address</td> 
    <td rowspan="2" class="remove">Remove</td> 
    </tr> 
    <tr> 
    <td>Name</td> 
    <td>Address</td> 
    </tr> 
</table> 

$('#personal tr .remove').click(function(){ 
$(this).parent().remove(); 
}) 

我想刪除受rowspan影響的2行。有可能的?如果是的話如何?現在它只刪除一行。如何用rowspan刪除行jquery

FIDDLE:http://jsfiddle.net/awanan/j3fNK/

回答

2

最簡單的方法:

$('#personal tr .remove').click(function(){ 
    $(this).parent().next().remove(); 
    $(this).parent().remove(); 
}) 
0

$(this).parent().next().remove();$(this).parent().remove();