Closed zanderle closed 6 years ago
This issue is duplicated of https://github.com/marioizquierdo/jquery.serializeJSON/issues/37
There's currently no option to identify empty select tags. But you can use an extra hidden field just like you would do with unchecked checkboxes:
<input name="myArray:array" type="hidden" value="[]" />
<select name="myArray[]" multiple >
<option value="1">1</option>
<option value="2">2</option>
</select>
$('input,select').serializeJSON();
Say you have a
select
element with no options selected:Would it be possible to have the result include an empty array? So something like:
I'm also happy to do a PR if this is not implemented, if you just point me in the general direction.