jquery - how find next row of button clicked in td? -
i have table , every row have row dispaly:none
.
want when clicked span
in td
of visible row
next row
visible.
i tried :-
$('span').click(function() $(this).closest('tr').next('tr').css('display','block') })
this switch display block tr not displayed correctly when it's display block default. when try next row width first column of currnet tr. whats problem?
<tr> <td style="width:40px"></td> <td><span>show</span></td> <td></td> </tr> <tr "style=display:none"> <td colspan="4" > <h5>پاسخ دادن</h5> <textarea style="width:100%;"></textarea> </td> </tr>
one easy solution set display blank like
$('span').click(function() { $(this).closest('tr').next('tr').css('display', '');//or set table-row default display tr })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <table> <tr> <td style="width:40px"></td> <td><span>show</span></td> <td></td> </tr> <tr style="display:none"> <td colspan="3"> <h5>پاسخ دادن</h5> <textarea style="width:100%;"></textarea> </td> </tr> </table>
Comments
Post a Comment