title: jQuery - ordering divs in ascending order
body: <p>So I have this code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var $divs = $("div.product");
  
  $('#priceAscending').on('click', function() {
   var ascendingOrderedDivs = $divs.sort(function(a, b) {
     return $(a).find("div.price").text() &gt; $(b).find("div.price").text();
    });
    $("#container").html(ascendingOrderedDivs);
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="wrap"&gt;
    
    &lt;button id="priceAscending"&gt;Price ascending&lt;/button&gt;
    &lt;!--&lt;button id="priceDescending"&gt;Price descending&lt;/button&gt;--&gt;
    
    &lt;div id="container"&gt;
      
      &lt;div class="product"&gt;
        &lt;span id="name"&gt;Product One&lt;/span&gt;
        &lt;div class="price"&gt;14.85$&lt;/div&gt;
      &lt;/div&gt;
      
      &lt;div class="product"&gt;
        &lt;span id="name"&gt;Product Two&lt;/span&gt;
        &lt;div class="price"&gt;27.59$&lt;/div&gt;
      &lt;/div&gt;
      
      &lt;div class="product"&gt;
        &lt;span id="name"&gt;Product Three&lt;/span&gt;
        &lt;div class="price"&gt;2.64$&lt;/div&gt;
      &lt;/div&gt;
      
    &lt;/div&gt;
    
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want to sort div.product in ascending order based on the price, but it doesn't work. It puts 2.64 in the middle but it should put it first.</p>
  
  <p>How can I fix this issue using jQuery?</p>