How to get form elements from multiple forms in a single page
<p>Using below code I can get form element types, names and values,</p>

<pre><code>var items = $("form :input").map(function(index, elm) {
    return {name: elm.name, type:elm.type, value: $(elm).val()};
});
</code></pre>

<p>I have multiple forms in a single page and I want to identify the form elements of each form based on the <strong>form name</strong> or <strong>form id</strong>.
For example, </p>

<pre><code>&lt;form name="test" method="post" id="test" action="" enctype="multipart/form-data"&gt; 

        &lt;input type="checkbox" name="chekbox"&gt;
        &lt;input type="email" name="email" id="email" &gt;
        &lt;textarea&gt;test&lt;/textarea&gt;
        &lt;input type="submit" name="submit"&gt;     
    &lt;/form&gt;
    &lt;form&gt;
        &lt;input type="text" name="search"&gt;
        &lt;input type="submit" name="search"&gt;
    &lt;/form&gt;
    &lt;form name="test2" id="test2"&gt;
        &lt;input type="text" name="search"&gt;
        &lt;input type="radio" name="a" value="a"&gt;&lt;input type="radio" name="a" value="b"&gt;
        &lt;input type="checkbox" name="chekbox"&gt;
        &lt;input type="submit" name="search"&gt;
    &lt;/form&gt;
</code></pre>

<p>I need the form elements of form name <strong>test</strong> and form name <strong>test2</strong> separately.</p>