简体   繁体   English

动态添加行表需要更改选择ID标记

[英]Dynamic adding row table needs to change select id tags

<select id="1" onchange="change(this,'2')">
<option value=" " selected="selected"></option>
<option value="A">Option One</option>
<option value="B">Option Two</option>
<option value="C">Option Three</option>
<option value="D">Option Four</option>
</select>

<select id="2" onchange="change(this,'1')">
<option value=" " selected="selected"></option>
<option value="A">Option One</option>
<option value="B">Option Two</option>
<option value="C">Option Three</option>
<option value="D">Option Four</option>
</select>

Adding the select tags on my next row of table will just clone the id's, is there a way around this? 在我的下一行表中添加选择标签只会克隆ID,是否可以解决此问题?

Sounds like your IDs are being incorrectly assigned. 听起来您的ID分配有误。 You can use Firebug or Chrome developer tools to see which IDs are being created on which dropdowns, and use that information to adjust your "change" function so that it can properly handle the adding of new rows. 您可以使用Firebug或Chrome开发者工具查看在哪个下拉列表中创建的ID,并使用该信息来调整“更改”功能,以便其可以正确处理添加新行的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM