我目前正在使用以下代码。哪个克隆一个元素并将克隆中的输入更改为我需要的。克隆中还有一个选择,我需要将其名称更改为另一个 val。如何同时在同一个克隆命令上执行 2 个孩子?
代码:
$(this).parent().parent()
.append($(this).parent()
.clone()
.children('input').attr('name', VAL)
.end()
);
我需要这样的东西
$(this).parent().parent()
.append($(this).parent()
.clone()
.children('input').attr('name', VAL)
.children('select').attr('name', VAL2) // Where this does not target children of the input, but of the clone.
.end()
);