문제

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???

올바른 솔루션이 없습니다

다른 팁

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().

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top