title: Comparing elements on .each()
body: <p>I'm trying to implement an accordion. I'm having a problem with comparing an element in the .each() loop.</p>
  
  <p>I start by finding the <code>.accordion</code> who's <code>.content</code> I need to expand. This is the parent of the <code>.accordion .title</code> element that was click (line 6 below).</p>
  
  <p>I then loop through each <code>.accordion</code> on the page. I try to detect which of those <code>.accordion</code> is the <code>parent</code>, to expand his <code>.content</code>. This isn't working.</p>
  
  <pre><code>// ACCORDION
  var accordions = $('.accordion').toArray();
  
  // Scroll down on click
  $('.accordion .title').click(function() {
      var parent = $(this).parent();
  
  
      $(accordions).each(function() {
  
          // Show this accordion if it's the parent of the .title clicked
          // Problem is here ********
          if ( $(this) == parent )
              $(this).children('.content').slideDown();
  
          // Hide all accordions except this parent
          else {
              $(this).children('.content').slideUp();
          }
  
      });
  
  });
  </code></pre>
  
  <p>My main question is a bit wider than this particular example:</p>
  
  <p><strong>How can I figure out if <code>$(this) == some_var_pointing_to_an_element</code> when looping through an array of elements like above?</strong></p>
  
  <p>EDIT: My accordion html if it's relevant:</p>
  
  <pre><code>&lt;div class=".accordion"&gt;
      &lt;div class=".title"&gt;Hello&lt;/div&gt;
      &lt;div class=".content"&gt;World&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>