$('#mytable').parent(rownum).parent().find(".one").text(name);
<table id="mytable" class="mytable">
<tr>
<td class="mytd">Name</td>
<td class="mytd">Age</td>
<td class="mytd">Gender</td>
<td class="mytd">Skills</td>
<td class="mytd">Note</td>
</tr>
<? while($row=mysql_fetch_array($res)){ ?>
<tr>
<td class='one'><? echo $row["name"];?></td>
<td class='two'><? echo $row["age"];?></td>
<td class='three'><? echo $row["gender"];?></td>
<td class='four'><? echo $row["skills"];?></td>
<td class='five'><? echo $row["note"] ;?></td>
<td><button id='edit' value='edit'>Edit</button></td>
<td><button value='delete' id='delete'>Delete</button></td>
</tr>
<? } ?>
</table>
我想通过将rownum传递给父级来更新所选的tr单元格值,但是它更新到所有tr的所有单元格。请帮助..
答案 0 :(得分:0)
我认为你需要这样的东西
$('#mytable tr').eq(rownum).find(".one").text(name)