Update all using jquery
<p><a href="http://jsfiddle.net/sureshmonster/namVk/1/" rel="nofollow">JSFiddle</a>. When i click the 2nd img then click next, it doesn't update. I want update the both next() and img at the same time. Is this possible ?</p>

<p>Html:</p>

<pre><code>&lt;div class="myclass selected"&gt;
Content 1
&lt;/div&gt;
&lt;div class="myclass"&gt;
Content 2
&lt;/div&gt;
&lt;div class="myclass"&gt;
Content 3
&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;img src="http://www.lillehammer.com/ImageVault/Images/id_2122/scope_66/ImageVaultHandler.aspx" /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;img src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Valued_image_seal.svg/40px-Valued_image_seal.svg.png" /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;img src="http://www.iconico.com/i/icoImageFilterPro100.gif" /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;a class="next"&gt;next&lt;/a&gt;
</code></pre>

<p>​
css:</p>

<pre><code>.myclass {display:none;}


img {height: 20px; width: 20px; position: relative; display: block; margin: 20px; float: left;}
​
</code></pre>

<p>javascript:</p>

<pre><code>$('img', 'ul').on('click', function() {
    $(".myclass").eq($(this).parent('li').index()).show()
                 .siblings('div').hide();
});

$('.selected').show();

$(".next").click(function(){
    var selected = $('.selected');
    selected.removeClass('selected');
    selected.hide();
    
    var next = selected.next(".myclass");
    if(next.length === 0) {
        next = $(".myclass").first();
    }
    next.addClass('selected');
    next.show();
   
});
</code></pre>
