title: jQuery - find last class on the element
body: <p>How to find last class on the element without knowing exact number of classes?</p>
  
  <p>Our element:</p>
  
  <pre><code> &lt;div class="class-1 class-2 some-other-class"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Normal approach with split will not work here, as we do not know the number of classes. Can we check the length of the <code>.split(' ')</code> ?</p>
  
  <pre><code>var i = $('div').prop('class');
  var j = i.split(' ')[x];
  </code></pre>
  
  <p>Any suggestions much appreciated. </p>