I have a form with many input fields.
When I catch the submit form event with jQuery, is it possible to get all the input fields of that form in an associative array?
javascriptjquery
I have a form with many input fields.
When I catch the submit form event with jQuery, is it possible to get all the input fields of that form in an associative array?
Best Answer
Thanks to the tip from Simon_Weaver, here is another way you could do it, using
serializeArray
:Note that this snippet will fail on
<select multiple>
elements.It appears that the new HTML 5 form inputs don't work with
serializeArray
in jQuery version 1.3. This works in version 1.4+