Question

I've noticed that if you exclude a Name and ID from a form element serializeArray will not return it's value. Is this correct/by design? Just curious...

<form id="myForm" name="JimTheForm">
  <input type="text" value="serializeArray doesn't see me" />
  <input id="someID" name="someName" type="text" value="serializeArray sees me!" />
</form>

in this example the first text field will not be included in serializeArray() but the second text field will because it has a name and id, i think???

No correct solution

OTHER TIPS

According to the .serializeArray() API Documentation :

The .serializeArray() method uses the standard W3C rules for successful controls to determine which elements it should include; in particular the element cannot be disabled and must contain a name attribute.

So, having the name attribute is a must for .serializeArray().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top