I want to group table tr by rowspan attribute like below how can I do faster useing jquery? do any can help?
<table border=1 width='100%'> <tr><td rowspan=3>ABC</td><td>A2</td><td>A3</td></tr> <tr><td>B2</td><td>B3</td></tr> <tr><td>C2</td><td>C3</td></tr> <tr><td rowspan=3>123</td><td>22</td><td>33</td></tr> <tr><td>44</td><td>55</td></tr> <tr><td>66</td><td>77</td></tr> </table>
this as group 1
<tr><td rowspan=3>ABC</td><td>A2</td><td>A3</td></tr> <tr><td>B2</td><td>B3</td></tr> <tr><td>C2</td><td>C3</td></tr>
this as group 2
<tr><td rowspan=3>123</td><td>22</td><td>33</td></tr> <tr><td>44</td><td>55</td></tr> <tr><td>66</td><td>77</td></tr>
my way
var arr_tr=new Array(); $('table tr').each(function(i){ if(o.find('td:eq(0)').is('[rowspan]')){ arr_tr[i]=new Array(); arr_tr[i].push($(this)); }else{ arr_tr[i].push(aaa); }; });
https://stackoverflow.com/questions/67352159/how-can-i-group-table-tr-useing-jquery-faster-and-better-way May 02, 2021 at 09:05AM
没有评论:
发表评论