Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
101
rated 0 times [  108] [ 7]  / answers: 1 / hits: 33267  / 12 Years ago, tue, march 13, 2012, 12:00:00
<table border=1>
<tr><td>111</td><td>22</td><td rowspan=3>ads</td></tr>
<tr><td>111</td><td class=remove>22</td></tr>
<tr><td>111</td><td class=remove>22</td></tr>
<tr><td>111</td><td>22</td><td rowspan=3>ads</td></tr>
<tr><td>111</td><td class=remove>22</td></tr>
<tr><td>111</td><td class=remove>22</td></tr>
<tr><td>111</td><td>22</td><td rowspan=3>ads</td></tr>
<tr><td>111</td><td class=remove>22</td></tr>
<tr><td>111</td><td class=remove>22</td></tr>
</table>

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


FIDDLE: http://jsfiddle.net/r5BDW/1/



If I remove TR then table is breaks because ROWSPAN is too large. Is possible modify ROWSPAN? If yes, how?


More From » jquery

 Answers
12
 $('.remove').click(function(){
$(this).parent()
.prevAll('tr:has(td[rowspan]):first')
.find('td[rowspan]')
.attr('rowspan', function(i, rs) { return rs - 1; })
.end()
.end()
.remove();
});



[#86890] Sunday, March 11, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
daytonm

Total Points: 519
Total Questions: 83
Total Answers: 89

Location: Saudi Arabia
Member since Mon, Sep 5, 2022
2 Years ago
;