Serialize Subsection
ALERT This plugin does not work with any current release of jQuery. It will work after revision 5826 with no changes. Prior to that it will require you to modify serializeArray() to query the existence of this.elements instead of jQuery.nodeName(this, "form").
This plugin creates a serialize function that operates on elements descending from a form. Requires the Ancestry plugin.
Usage:
<form>
<ol>
<li id="first">
<input id="firstname" type="text" />
<input id="lastname" type="text" />
</li>
<li>
<input id="address1" type="text" />
<input id="address2" type="text" />
</li>
<li>
<input id="mobile" type="text" />
<input id="email" type="text" />
</li>
</ol>
</form>
// Returns the same results as if serializeArray() were called on the parent form element, restricted to only include the elements descending from the form.
$(#first).serializeSubsection();
评论