Side navigation
#13357 closed bug (notabug)
Opened January 31, 2013 12:59PM UTC
Closed January 31, 2013 01:31PM UTC
Last modified July 22, 2014 03:03PM UTC
serialize() behaves inconsistently for fieldset
Reported by: | mikecapp | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.9.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have a large-ish form already organized into fieldsets, and I want to serialize a subset of those fields for an AJAX call. The obvious approach was $("#somefieldset").serialize(), but while this works in Chrome it returns nothing in IE7. It's not clear from the docs whether this *should* work, but if not the results should at least be consistent.
$("#somefieldset input").serialize() is fine as a workaround, so this isn't the end of the world.
Fiddle: http://jsfiddle.net/mikecapp/rSwUW/
Chrome output: core1=one&core2=two
IE7 output: nothing!
The method is consistent with its documentation. There's no mention of handling the
<fieldset>
container element.It can take either a
<form>
element (in which case it will serialize theform.elements
property) or a jQuery set of form inputs. It may be possible to pass in other things and get outputs but they're not documented.