jQuery serializeArray not picking up dynamically created form elements jQuery serializeArray not picking up dynamically created form elements ajax ajax

jQuery serializeArray not picking up dynamically created form elements


I'll expound upon the comment a bit more here:

When you call .serializeArray() it's looping through just as a <form> submission would or as close as possible anyway, to get the elements to be submitted. The key part is here:

.filter(function() {  return this.name && !this.disabled &&         (this.checked || rselectTextarea.test(this.nodeName) ||         rinput.test(this.type));})

Just as a <form> submit wouldn't include elements without a name attribute, the .filter() call using this.name will filter those elements out of ones to be serialized.


For anyone else that finds this as an "issue", please note that as per Nick Craver's comment above, all that's required is to ensure that the "name" attribute is appended to the new form elements that are created dynamically. This resolved my problem! Thank you very much indeed Nick!