我需要一种与
具体来说,我希望访问第一行的第一列,然后是第二列,以此类推。 然后转到第二行并重复该过程。
类似这样的伪代码:
tr
中的每个td
元素交互的方法。具体来说,我希望访问第一行的第一列,然后是第二列,以此类推。 然后转到第二行并重复该过程。
类似这样的伪代码:
for each row in table
{
for each column in row
{
do cool things
}
}
jQuery:
$('#tblNewAttendees tr').each(function() {
alert('tr');
//Cool jquery magic that lets me iterate over all the td only in this row
$(magicSelector).each(function(){
alert('hi');
});
});
HTML:
<table>
<thead>
<th>someHeader</th>
</thead>
<tbody>
<tr>
<td>want to grab this first</td>
<td> this second </td>
</tr>
<tr>
<td>this third</td>
<td>this fourth</td>
</tr>
</tbody>
</table>