title: Jquery: using closest selector issue
body: <p>I am trying to learn some jQuery and working through some tutorials. I am very early in the process and learning to move through the DOM with <code>.parent()</code>, <code>.parents()</code> and <code>.closest()</code>. </p>
  
  <p>I was chugging a long and then became perplexed as to why I couldnt select a certain element (<code>p</code> tag with a class) and add a class to it.</p>
  
  <p>Mind you.. these are just exercises.. I wouldnt select something this way but I want to see that it can be done.</p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;h1&gt;Hello World&lt;/h1&gt;
      &lt;h2&gt;This is a tutorial&lt;/h2&gt;
  
      &lt;p class="para"&gt;This is a tutorial for jquery and jquery UI&lt;/p&gt;
  
  
  &lt;div class="container"&gt;
      &lt;ul class="listItem container"&gt;
          &lt;li&gt;Hello 1&lt;/li&gt;
          &lt;li&gt;Hello 2&lt;/li&gt;
          &lt;li&gt;
              &lt;ul class="nest"&gt;
                  &lt;li&gt;Nest 1&lt;/li&gt;
                  &lt;li&gt;Nest 2&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/li&gt;
      &lt;/ul&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>jQuery</p>
  
  <pre><code>//$('ul.listItem').find('li').first().addClass('listItem2');
  //$('li').parent().removeClass('listItem');
  $('ul.nest').children('li:first').addClass('listItem');
  $('ul.listItem').closest('.container').removeClass('container');
  $('ul.listItem').children('li:nth-child(2)').addClass('listItem3');
  $('ul.listItem').closest('.para').addClass('listItem2');
  
  
  //console.log($('ul').parents('.container'));
  console.log($('ul').closest('.container'));
  console.log($('ul.listItem').closest('.para'));
  </code></pre>
  
  <p>My question is why will it not select the <code>p</code> tag in this example and add the class <code>listItem2</code> to it?  It finds the container tag just fine but not the <code>p</code> tag, or even the <code>para</code> class.  In the console log it shows nothing, but yet finds the container class just fine. Just thought I should know before moving on. Thanks</p>