简体   繁体   中英

jQuery form elements not loaded dynamically

I'm not sure why, but when I call $(form).serialize() it returns object within dynamically created elements.

I have this html syntax:

<form id="form1"></form>
<input type="text" name="formItem[0][value]" value="XX" />
<input type="text" name="formItem[INDEX][value]" value="XX" />

I call method to clone input[name="formItem[0][value]"] and replace INDEX with 1, so then I have form like this:

<form id="form1"></form>
<input type="text" name="formItem[0][value]" value="XX" />
<input type="text" name="formItem[1][value]" value="XX" />
<input type="text" name="formItem[INDEX][value]" value="XX" />

But then, when I call method to serialize form, there are still same count of elements -> two - but for this example: When I submit form for first time, with no cloned input, there was formItem[0][value] and formItem[INDEX][value] , but when I call clone and then submit form, serializeArray method return formItem[0][value] and formItem[1][value] . 在此处输入图片说明

Do you have any idea, how to solve my problem? https://jsfiddle.net/8u83h22j/2/

已解决 - 使用 Chrome 而不是 Safari 浏览器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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