How to change images at runtime in jQuery
<p>I need to change the images on every click using jQuery, lets say while the page loads for the first time it will be img1 and when i click on img1 it will be img2 and again if i click on img2 it will b img 1, and this should go on...
code:</p>

<pre><code>          &lt;div&gt;
           &lt;span class="myimage"&gt;
          &lt;img class="img1"src="8A7FA0A1FFEC5443785B9B29AF7629.jpg" alt="" /&gt;
         &lt;img class="img2"src="abcd.jpg" alt="" /&gt;
           &lt;/span&gt;
            &lt;div&gt;
              &lt;span&gt;
                Hello
            &lt;/span&gt;
           &lt;ul class="myul"&gt;
              &lt;li&gt;one&lt;/li&gt;
          &lt;li&gt;Two&lt;/li&gt;
              &lt;/ul&gt;
           &lt;/div&gt;
           &lt;span class="myimage"&gt;
          &lt;img class="img1"src="8A7FA0A1FFEC5443785B9B29AF7629.jpg" alt="" /&gt;
          &lt;img class="img2"src="abcd.jpg" alt="" /&gt;
          &lt;/span&gt;
            &lt;div&gt;
              &lt;span&gt;
               r u there
           &lt;/span&gt;
          &lt;ul class="myul"&gt;
            &lt;li&gt;three&lt;/li&gt;
                &lt;li&gt;four&lt;/li&gt;
                &lt;/ul&gt;
             &lt;/div&gt;
             &lt;/div&gt;
</code></pre>

<p>jQuery:</p>

<pre><code> $(document).ready(function() {

        $(".myul").hide();

        $(".myimage").click(function() {

            if ($(".img2").is(":hidden")) {
                $(this).next("div").find(".myul").slideToggle(600);

                $(".img1").hide();
                $(".img2").show();
            }
            else {

               $(this).next("div").find(".myul").slideToggle(600);
               $(".img2").hide();
                $(".img1").show();

            }

        });
    });
</code></pre>

<p>but the probelm is as the class is same both the sections are taking same image.when i am clicking on the first section, only the image for the first section should be changed, how to do taht..any suggestions</p>
