Serialize Subsection

联合创作 · 2023-10-02 15:24

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();
浏览 1
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报