I need serializeArray() to return all items in the selection box every time and not just the currently selected item(s) as the content of my selectionBox can grow or shrink.
<select multiple="multiple" id="selectionBox" >
<option value="email1@test.com">Test1</option>
<option value="email2@test.com">Test2</option>
<option value="email3@test.com">Test3</option>
<option value="email4@test.com">Test4</option>
<option value="email5@test.com">Test5</option>
</select>
…
//Select 1 item in the select list box
formArray = $("#selectionBox").serializeArray();
alert(formArray.length); // this will be 1
//Select 5 items in the select list box
formArray = $("#selectionBox").serializeArray();
alert(formArray.length); // this will be 5
I need it to always return the full 5.
I think
serializeArrayjust serializes those values that will be sent by the form. If you want all the options, you will have to code it yourself, like this: