我喜歡這個 -選擇從位於特定行表中的文本輸入
<table class='table'>
<tr>
<td class="td"><input type="text" name="name<%=f.getId()%>" value="<%=f.getName()%>"/>
</td>
<td class="td"><input type="text" id="field_length" size="3" name="length<%=f.getId()%>" value="<%=f.getLength()%>"/></td>
<td class="td"><input type="text" name="tooltip<%=f.getId()%>" value="<%=f.getToolTip()%>"/></td>
</tr>
<tr>
same like the previous.......
</tr>
<tr>
same like previous....
</tr>
表現在我想在位於第二排id爲「FIELD_LENGTH」文本框中更改值。我試圖用jQuery來做到這一點。
$(‘tr:nth-child(2) input:text#field_length’).val(10);
但這不起作用。任何機構可以爲我提供一些幫助。
只需使用'id'選擇輸入,如果你有相同'id'你有無效的HTML多種元素,並應糾正。 – 2012-08-08 09:42:36