0
 $('#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 的所有单元格。请帮助..

4

1 回答 1

0

我想你需要这样的东西

$('#mytable tr').eq(rownum).find(".one").text(name)
于 2013-09-04T08:50:41.187 回答