这是我的 JSFiddle:https://jsfiddle.net/inchrvndr/7pwh9p8g/
The bordered form elements get cloned on click of "+" button.
所有克隆的表单元素的值都被传递到 JSON 中,除了正在制作克隆的父元素。
单击“保存”按钮后,您可以看到除第一个带边框的 div 之外的所有表单字段值的 JSON 对象的警报。
为什么会这样?请帮忙。 谢谢:)
最佳答案
我已经解决了这个问题。
这是回答的 fiddle :AnswerFiddle
I added the Join Operator into the same "to-be-cloned" div and hid its div before cloning.
克隆后可见,即点击“+”按钮后。 现在,所有克隆之前和克隆之后的表单字段的值都被传递到 JSON 中。
关于javascript - 表单字段值未正确传递到 JSON 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44253729/