Determine which element comes first
<p>I have an array with objects id's:</p>

<pre><code>one
two
there
etc..
</code></pre>

<p>And i have quite a long object list:</p>

<pre><code>&lt;div id="container"&gt;
  &lt;input type="text" id="one" /&gt;
  &lt;input type="text" id="two" /&gt;
  &lt;input type="text" id="three" /&gt;
&lt;/div&gt;
</code></pre>

<p>This is not the actual html code, just a simplified version.</p>

<p>Now my array with id's keeps changing, and my question would be
how can i find out which element from that array is the first element in <code>#container</code> div</p>

<p>For example if i have this order:</p>

<pre><code>{
  email 
  name
  date
}
</code></pre>

<p>And this list of html objects</p>

<pre><code>&lt;div id="container"&gt;
  &lt;input type="text" id="name" /&gt;
  &lt;input type="text" id="last_name" /&gt;
  &lt;input type="text" id="email" /&gt;
  &lt;input type="text" id="date" /&gt;
&lt;/div&gt;
</code></pre>

<p><code>name</code> would be first, but in that array in some cases <code>name</code> item won't exist so it won't always be the name, i hope this makes any sense :)</p>
