我需要使用下面的方法設置使用兒童值輸入字段()
<table width="50%" border="0" id="pls-batting">
<tr id="1">
<td>
<input name="in" type="text" value="5">
</td>
</tr>
<tr id="2">
<td>
<input name="in" type="text" value="">
</td>
</tr>
</table>
value = $("table#pls-batting tr:nth-child(1) td:nth-child(1)").children().val();
設置輸入值。當我提醒它返回值「5」。這很好,很好。同樣,我需要將該值設置爲第二行的輸入字段。我用下面的代碼
$("table#pls-batting tr:nth-child(2) td:nth-child(1)").children().val='test';
但它不工作。有什麼方法可以使用children()
方法或使用行ID來設置值?
設置你使用'.VAL( '測試')' – 2012-02-07 09:59:20