Find the value of a div id based on partial match
<p>I have several divs on a page. They are formatted like:</p>

<pre><code>&lt;div id='profile-1'&gt;&lt;/div&gt;
&lt;div id='profile-2'&gt;&lt;/div&gt;
&lt;div id='profile-3'&gt;&lt;/div&gt;
&lt;div id='profile-4'&gt;&lt;/div&gt;
</code></pre>

<p>I need to find the value of the div with the highest id. In the previous example it would be "profile-4" (because 4 is the highest).</p>

<p>I've figured out how to search through the divs by using:</p>

<pre><code>var elements = $('[id^=profile-]')
</code></pre>

<p>This returns an object. I need to take that object and figure out that "profile-4" is the highest and if possible extract the value "4". </p>

<p>Any ideas? </p>
