title: Sorting input radio boxes alphabetically
body: <p>I am trying to sort this items alphabetically but it is not sorting all items as it should be. Can you give me some ideas why it is not working ?
  Here is my fiddle example.</p>
  
  <p><a href="http://jsfiddle.net/kn42tj3e/" rel="nofollow"><code>jsFiddle Link</code></a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>handleAlphaOrder = function() {
      var fieldItem = $('.field_item');
      var sorted = $(fieldItem.toArray().sort(function(a, b) {
          return $(a).find('label').text() &gt; $(b).find('label').text()
      }));
  
      fieldItem.each(function(i) {
          $(this).after(sorted.eq(i));
      });
  };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="1" id="productspage-category-women"&gt;
      &lt;label for="productspage-category-women"&gt;Women&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="1-2" id="productspage-category-womenbags"&gt;
      &lt;label for="productspage-category-womenbags"&gt;Women's bags&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="1-4" id="productspage-category-jewellery"&gt;
      &lt;label for="productspage-category-jewellery"&gt;Jewellery&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="2" id="productspage-category-men"&gt;
      &lt;label for="productspage-category-men"&gt;Men&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="2-2" id="productspage-category-menbags"&gt;
      &lt;label for="productspage-category-menbags"&gt;Men's bags&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="2-4" id="productspage-category-menshoes"&gt;
      &lt;label for="productspage-category-menshoes"&gt;Men's shoes&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="3-1" id="productspage-category-baby"&gt;
      &lt;label for="productspage-category-baby"&gt;Baby&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="3-3" id="productspage-category-girl"&gt;
      &lt;label for="productspage-category-girl"&gt;Girl&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4" id="productspage-category-home"&gt;
      &lt;label for="productspage-category-home"&gt;Home&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4-2" id="productspage-category-bed"&gt;
      &lt;label for="productspage-category-bed"&gt;Bed&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4-5" id="productspage-category-kitchen"&gt;
      &lt;label for="productspage-category-kitchen"&gt;Kitchen&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4-7" id="productspage-category-lighting"&gt;
      &lt;label for="productspage-category-lighting"&gt;Lighting&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4-10" id="productspage-category-outdoor"&gt;
      &lt;label for="productspage-category-outdoor"&gt;Outdoor&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="5-1" id="productspage-category-haircare"&gt;
      &lt;label for="productspage-category-haircare"&gt;Hair care&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="5-3" id="productspage-category-mengrooming"&gt;
      &lt;label for="productspage-category-mengrooming"&gt;Men's grooming&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="5-6" id="productspage-category-skincare"&gt;
      &lt;label for="productspage-category-skincare"&gt;Skincare&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="6" id="productspage-category-lifestyle"&gt;
      &lt;label for="productspage-category-lifestyle"&gt;Lifestyle&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="6-4" id="productspage-category-foodsupplements"&gt;
      &lt;label for="productspage-category-foodsupplements"&gt;Food supplements&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="6-5" id="productspage-category-treatments"&gt;
      &lt;label for="productspage-category-treatments"&gt;Treatments&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="6-6" id="productspage-category-electronics"&gt;
      &lt;label for="productspage-category-electronics"&gt;Electronics&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="" id="productspage-category-all"&gt;
      &lt;label for="productspage-category-all"&gt;All&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="1-1" id="productspage-category-womenaccessories"&gt;
      &lt;label for="productspage-category-womenaccessories"&gt;Women's accessories&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="1-3" id="productspage-category-womenclothing"&gt;
      &lt;label for="productspage-category-womenclothing"&gt;Women's clothing&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="1-5" id="productspage-category-womenshoes"&gt;
      &lt;label for="productspage-category-womenshoes"&gt;Women's shoes&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="2-1" id="productspage-category-menaccessories"&gt;
      &lt;label for="productspage-category-menaccessories"&gt;Men's accessories&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="2-3" id="productspage-category-menclothing"&gt;
      &lt;label for="productspage-category-menclothing"&gt;Men's clothing&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="3" id="productspage-category-kids"&gt;
      &lt;label for="productspage-category-kids"&gt;Kids&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="3-2" id="productspage-category-boy"&gt;
      &lt;label for="productspage-category-boy"&gt;Boy&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="3-4" id="productspage-category-toys"&gt;
      &lt;label for="productspage-category-toys"&gt;Toys&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4-1" id="productspage-category-bath"&gt;
      &lt;label for="productspage-category-bath"&gt;Bath&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4-3" id="productspage-category-childrenhome"&gt;
      &lt;label for="productspage-category-childrenhome"&gt;Children's home&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4-6" id="productspage-category-furniture"&gt;
      &lt;label for="productspage-category-furniture"&gt;Furniture&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="4-11" id="productspage-category-decor"&gt;
      &lt;label for="productspage-category-decor"&gt;Decor&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="5" id="productspage-category-beauty"&gt;
      &lt;label for="productspage-category-beauty"&gt;Beauty&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="5-2" id="productspage-category-makeup"&gt;
      &lt;label for="productspage-category-makeup"&gt;Makeup&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="5-5" id="productspage-category-perfume"&gt;
      &lt;label for="productspage-category-perfume"&gt;Perfume&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="5-8" id="productspage-category-healthbody"&gt;
      &lt;label for="productspage-category-healthbody"&gt;Health &amp;amp; body&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="6-1" id="productspage-category-fooddrinks"&gt;
      &lt;label for="productspage-category-fooddrinks"&gt;Food &amp;amp; drinks&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="6-2" id="productspage-category-yoga"&gt;
      &lt;label for="productspage-category-yoga"&gt;Yoga&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="6-3" id="productspage-category-gadgets"&gt;
      &lt;label for="productspage-category-gadgets"&gt;Gadgets&lt;/label&gt;
  &lt;/div&gt;
  &lt;div class="field_item"&gt;
      &lt;input type="radio" name="category" value="6-7" id="productspage-category-fitness"&gt;
      &lt;label for="productspage-category-fitness"&gt;Fitness&lt;/label&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>