title: Sorting a HTML dropdown-menu with decimals correctly
body: <p>I'm currently using a dropdown-menu where the user can select an application version (e.g. <code>1.0.4.3-0001</code>) to get more information on this specific version. To let the user find the correct version faster I want to sort this dropdown-menu so that the latest version is on top and the lowest version (<code>1.0.0.0-0001</code>) is at the bottom. Because all versions are getting fetched from a server and new ones can appear every day, I cannot sort them by hand.</p>
  
  <p>I tried various jQuery and JavaScript codes to sort it right, but none of the codes seem to work with decimals like application versions (because it thinks <code>1.0.2.0</code> is newer than <code>1.0.12.0</code> for example). Does anyone know how to work with such a specific case?</p>
  
  <p>Just in case anyone wants to see the code I've tried so far (with 'version' being my dropdown):</p>
  
  <pre><code>$("#version").html($("#version option").sort(function (a, b) {
      return a.text == b.text ? 0 : a.text &lt; b.text ? -1 : 1
  }))
  </code></pre>
  
  <p>Many thanks in advance.</p>