title: Find parent and first child of it's parent
body: <p>I am trying to find the parent of an element and it's parent first child, the code is like this:</p>
  
  <pre><code>        &lt;ul class="lowerMenu"&gt;
              &lt;li&gt;&lt;a href="" class="selected"&gt;Welcome&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;Logo&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;Websites&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;Stationery&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;Illustration&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href=""&gt;Full Pack&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
  
  function setIntervalAndExecute() {
      changeImages();
      setTimeout(function(){
          showImages(imagesArray);
      },500);
      var intervalot = window.setInterval(function(){
          changeImages();
          var selected = $('.selected');
          if (!selected.parent().is(':last-child')) {
              $('.selected').parent().next().children().addClass('selected');
              selected.removeClass('selected');
          } else {
              $('.selected').parent().parent().children(':first-child').addClass('selected');
              selected.removeClass('selected'); // nesho ne mi rabotit ovdeki
          }
          window.setTimeout(function(){
              showImages(imagesArray);
          },500);
      },10000);
      return intervalot;
  }
  var intervalot = setIntervalAndExecute();
  </code></pre>
  
  <p>I know it's a little complicated but i'm new to jquery , so what i'm trying to do is after the class 'selected' gets to the last  element i want to remove it and set it to the first  element. I've tried with this but it doesn't seem to be working</p>
  
  <pre><code>$('.selected').parent().parent().children(':first-child').addClass('selected');
  </code></pre>
  
  <p>and when it gets to the last  element the interval is executing twice and then stops.
  This is the site that i'm working on:</p>
  
  <blockquote>
    <p><a href="http://nikodola.com/testsite">http://nikodola.com/testsite</a></p>
  </blockquote>