title: Jquery - Adding Class to an image tag of active Carousel image
body: <p>I have managed to get a carousel so that when the image is changed it will display what number image you are looking at.</p>
  
  <p>if it is image number 3 that is chosen, 3 list rows down is the current images' code. Am i able to get this is automatically add a class to the image tag imbedded within the list? Below is my code with the itemvisiblein function basically printing out to a certain div. </p>
  
  <p>How am i able clear all classes of the active name and then take that number and add the class to the image tag of that certain line? (same class as caption is currently in) (so if image 3 is selected then add "active" to the image tag imbedded within that code 3 list lines down. </p>
  
  <p>Cheers,</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function itemVisibleIn(carousel, state){
      $("#gallerydescription").html(carousel.first);  //currently displays image number//
  
  };
  
  jQuery(document).ready(function() {
      jQuery('#mycarousel').jcarousel({
      easing: 'backout',
          animation: 1000,
      vertical: true,
          scroll: 1,
      itemVisibleInCallback: itemVisibleIn, 
         });
  });
  
  &lt;ul id="mycarousel" class="jcarousel jcarousel-skin-tango"&gt;
          &lt;li&gt;&lt;a href="images/gallery/placeholder1.png" rel="shadowbox" title="This is the description"&gt;&lt;img class="caption" src="images/gallery/placeholder1.png" width="750" height="450" title="test Title1" alt="This is the title" /&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="images/gallery/placeholder1.png" rel="shadowbox" title="This is the description"&gt;&lt;img class="caption" src="images/gallery/placeholder1.png" width="750" height="450" title="test Title1" alt="This is the title" /&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="images/gallery/placeholder1.png" rel="shadowbox" title="This is the description"&gt;&lt;img class="caption" src="images/gallery/placeholder1.png" width="750" height="450" title="test Title1" alt="This is the title" /&gt;&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>So in short </p>
  
  <p><strong>1</strong>) get which line is being used for that image (list line)
  <strong>2</strong>) clear all previous active classes
  <strong>3</strong>) add class active to image tag class (along with caption) of the currently selected image</p>