title: Jquery hide all apart from selected index from cached selector
body: <p>This is hiding everything and not excluding the selected index. </p>
  
  <pre><code>this.showGroup = function(groupIndex) {
  
      var $groups = $("#products &gt; li.group");    
  
      // Hide all groups apart from selected index
      $groups.not(groupIndex).find(".scroller").hide();
  
      // Show selected index
      $groups.eq(groupIndex).find(".scroller").slideDown();
  </code></pre>
  
  <p>I can't change the first line <code>$groups</code> because this is used further down my function and needs to select all of the groups. </p>