title: Find max of data attribute value of all li items
body: <p>I have a list which makes use of Jquery UI Sortable. Each list item has a special data-itemid value which is a unique number. User can add items to this list and then sort them. I want to find the max value of the data-itemid attribute regardless of their position in the list.</p>
  
  <p>Before I had implemented Sortable, I could just fetch the value of last-child using <code>$('li:last-child').data('itemid')</code> but after integrating the sorting functionality, the last child might not have the maximum value. </p>
  
  <p>My code is as follows: </p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;ul id='sortable'&gt;
     &lt;li data-itemid='1'&gt;One&lt;/li&gt;
     &lt;li data-itemid='2'&gt;Two&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>$(document).ready(function(){
    maxItemId = $('li:last-child').data('itemid');
    alert('Max Item Id is: ' + maxItemId);
  });
  </code></pre>
  
  <p>I figured I could just go through each li item and look for the one with the max Id, I was hoping there was a better alternative to it.</p>