How to hide and show images on thumbnail image click using jquery or javascript
<p>I am trying to use javascript/jquery.</p>

<p>I have got below HTML where I want to work on "onclick" event of image link.</p>

<pre><code>&lt;div id="galleryContainer"&gt;
    &lt;ul class="galleryThumbnails"&gt;
        &lt;li&gt;&lt;a href="/99/english/destinations_offers/destinations/asiapacific/india/newdelhi/photo.aspx?item=media_616165_ID0EV&amp;amp;menu=image_616165#mplayer_616165"&gt;
            &lt;img width="70" height="56" src="http://dxbmiwwekdev1.corp.com/99/english/images/thumb_616143_tcm481-616166.jpg"
                class="mpMenuItemSelected" id="thumb_616165_ID0EV" title="New Delhi Zoo" alt="New Delhi Zoo"&gt;&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="/99/english/destinations_offers/destinations/asiapacific/india/newdelhi/photo.aspx?item=media_616165_ID0E3&amp;amp;menu=image_616165#mplayer_616165"&gt;
            &lt;img width="70" height="56" src="http://dxbmiwwekdev1.corp.com/99/english/images/thumb_616146_tcm481-616168.jpg"
                class="mpMenuItemOff" id="thumb_616165_ID0E3" title="New Delhi Zoo" alt="New Delhi Zoo"&gt;&lt;/a&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="/99/english/destinations_offers/destinations/asiapacific/india/newdelhi/photo.aspx?item=media_616165_ID0EDB&amp;amp;menu=image_616165#mplayer_616165"&gt;
            &lt;img width="70" height="56" src="http://dxbmiwwekdev1.corp.com/99/english/images/redfort_tcm481-616158.jpg"
                class="mpMenuItemOff" id="thumb_616165_ID0EDB" title="New Delhi RedFort" alt="New Delhi RedFort"&gt;&lt;/a&gt;
        &lt;/li&gt;
    &lt;/ul&gt;       
        &lt;div id="media_616165_ID0EV" class="galleryImage"&gt;
        &lt;img width="390" height="312" alt="New Delhi Zoo" title="New Delhi Zoo" src="http://dxbmiwwekdev1.corp.com/99/english/images/10894_tcm481-616143.jpg"&gt;&lt;/div&gt;

    &lt;div style="display: none;" id="media_616165_ID0E3" class="galleryImage"&gt;
        &lt;img width="390" height="312" alt="New Delhi Zoo" title="New Delhi Zoo" src="http://dxbmiwwekdev1.corp.com/99/english/images/deer_tcm481-616146.jpg"&gt;&lt;/div&gt;

    &lt;div style="display: none;" id="media_616165_ID0EDB" class="galleryImage"&gt;
        &lt;img width="390" height="312" alt="New Delhi RedFort" title="New Delhi RedFort" src="http://dxbmiwwekdev1.corp.com/99/english/images/redfort_tcm481-616157.jpg"&gt;&lt;/div&gt;      
&lt;/div&gt;  
</code></pre>

<p>In above HTML, I have got thumbnail images ( please see the <strong>UL</strong>) for example</p>

<pre><code>&lt;img width="70" height="56" src="http://dxbmiwwekdev1.corp.com/99/english/images/thumb_616143_tcm481-616166.jpg"
                class="mpMenuItemSelected" id="thumb_616165_ID0EV" title="New Delhi Zoo" alt="New Delhi Zoo"&gt;
</code></pre>

<p>Now I have got separate galleryImage div section for every thumbnail Image, which will show on the click on thumbnail image. For example to the above thumbnail there is </p>

<pre><code>    &lt;div id="media_616165_ID0EV" class="galleryImage"&gt;
&lt;img width="390" height="312" alt="New Delhi Zoo" title="New Delhi Zoo" src="http://dxbmiwwekdev1.corp.com/99/english/images/10894_tcm481-616143.jpg"&gt;&lt;/div&gt;
</code></pre>

<p>I want to hide and show the images according to the thumbnail is clicked.</p>

<p><strong>EDIT:</strong></p>

<p>I am having tab functionality as a link when first time the page is rendered the below @Rahul code works perfectly, however after navigating the any tab and again coming back it stops working the reason is that after coming back on same tab, my previous jquery code adds and extra div with same contents, below jquery get confused as my page now will be having same code twice. Please see the  example code when first time page is rendered.</p>

<pre><code>&lt;div class="tabs-container" id="tab-container"&gt;
top above html is rendered here
&lt;/div&gt;
</code></pre>

<p>Now after navigating to other tab and coming back to same tab, now html on page is as below, the above mentioned code remain there in page with style="display: none;" an extra div is added to play the tab functionality:</p>

<pre><code>&lt;div class="tabs-container" id="tab-container" style="display: none;"&gt;
top above html is rendered here
&lt;/div&gt;
&lt;div id="divContenttab5" style="display: block;" class="dynDiv"&gt;
  &lt;div class="tabs-container" id="tab-container"&gt;
      top above html is rendered here
&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Now the below Jquery stops working as there are same two type of htmls.</p>

<p>Please suggest!</p>

<p>Thanks.</p>

<p>Best Regards,
MKS</p>
