Jquery - multiple selectors - get elements in sequence
<p>I have a form like this</p>

<pre><code>&lt;form id="myform"&gt;
&lt;input type="hidden" name="a" value="a1"/&gt;
&lt;input type="hidden" name="b" value="b2"/&gt;
&lt;select name="c"&gt;&lt;option value="c3" selected="true"/&gt;&lt;/select&gt;
&lt;input type="text" name="d" value="d4"/&gt;
&lt;/form&gt;
</code></pre>

<p>Now, I want to get list of all input and select elements in the form</p>

<pre><code>  var mydata = new Array();
  $('#myform').find('input, select').each(function ()
  {
    mydata.push($(this).val());
  });
</code></pre>

<p>Result I am getting is: a1, b2, d4, c3
But what I want to get is: a1,b2,c3,d4 (in the same sequence as displayed in UI).</p>

<p>Note: I can give some dummy class (say: mydatafields) to all the input and select elements and use:</p>

<pre><code>$('mydatafields').forEach()
</code></pre>

<p>something like, but I am checking if there is a better solution.</p>

<p>Thanks in advance.</p>
