我将数据追加到tbody
,这是通过ajax请求获得的。在后端我打印这样如何获得动态添加的中的下一个输入的值
echo "<tr>
<td><input type='text' name='sl_p_codes[]' id='p_code' value='{$data['p_code']}' ></td>
<td><input type='text' name='sl_products[]' id='qty' value='{$data['p_name']}' ></td>
<td><input type='text' id='product_qty' name='sl_p_qty[]' id='qt' value='01' size='2'></td>
<td><input type='hidden' name='sl_unit_cost[]' id='product_unit_price'></td>
<td><input type='text' id='product_total_cost' readonly name='sl_price[]' id='qty' value='{$data['p_price']}' ></td>
<td class='center'><a href='#' onclick='delrow(this);' class='btn btn-danger'>X</a></td>
</tr>";
如果我改变id='product_qty'
(输入字段)id='product_total_cost'
(输入字段)的值应与id='product_unit_price'
这听起来像是你知道你需要什么,我建议你开始正在做。 StackOverflow不是您编写规范的网站,而是其他人为您编写代码。显示你迄今为止所写的内容,并准确描述你卡在哪里。 – Tomalak
我没有得到输出到有ID的输入字段product_total_cost –
请再次阅读我的评论。注意最后一句话。 – Tomalak