Note that there are some explanatory texts on larger screens.

plurals
  1. POimg thumbnail click replace div text value with thumbnail title
    primarykey
    data
    text
    <p><a href="http://jsfiddle.net/Plugins4/T3J3r/25/" rel="nofollow">JSFIDDLE HERE</a></p> <p>If you look at the js fiddle you will find clicking the thumbail changes the image aswell as the <code>.currentimgtitle</code> text value but it changes all <code>.currentimgtitle</code> text values on the page when i only want to change the one relevant to it the jquery and html are below</p> <pre><code>$(".imgcontainer").each(function() { var imgsrc = $(".minicontainer img:first-child", this).attr("src"); var imgtitle = $(".minicontainer img:first-child", this).attr("title"); $(this).append('&lt;div class="presentouter"&gt;&lt;img src="' + imgsrc + '" class="presentimg"/&gt;&lt;div class="currentimgtitle" title="' + imgtitle + '"&gt;' + imgtitle + '&lt;/div&gt;&lt;/div&gt;'); }); $(".miniimg, .miniimg2, .miniimg3").click(function() { var miniimgrc = $(this).attr("src"), $presentImg = $(this).closest(".imgcontainer").find(".presentimg"); $presentImg.attr('src', miniimgrc); }); $(".miniimg, .miniimg2, .miniimg3").click(function(index) { var miniimgtitle = $(this).attr("title"), $presentTitle = $(this).closest(".imgcontainer").find(".currentimgtitle"); $presentTitle.attr('title', miniimgtitle); }); $(".imgcontainer").each(function(index) { $(".miniimg, .miniimg2, .miniimg3").click(function() { var textval = $(this).attr("title"); $(".currentimgtitle").text(textval); }); }); &lt;div class="imgcontainer"&gt; &lt;div class="minicontainer"&gt; &lt;img src="http://lh3.googleusercontent.com/_Zuzii37VUO4/Ta0nUeMwXoI/AAAAAAAAFoc/7f0Um7OTgNg/s000/Antartic-by-Peter-Rejcek.jpg" title="icy mountains" class="miniimg"/&gt; &lt;img src="http://lh3.googleusercontent.com/_Zuzii37VUO4/Ta0nUFUhg6I/AAAAAAAAFoY/GToUxRYcteY/s000/Antartic-by-Kelly-Speelman.jpg" title="icy planes and hills" class="miniimg2"/&gt; &lt;img src="http://lh4.googleusercontent.com/_Zuzii37VUO4/Ta0nTs8AbPI/AAAAAAAAFoU/zCvNKv4kfe4/s000/BeachWaves-By-RePublicDomain.jpg" title="sun rise with clouds" class="miniimg3"/&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="imgcontainer"&gt; &lt;div class="minicontainer"&gt; &lt;img src="http://3.bp.blogspot.com/-EyJOI3UFWvo/Te5KHGgOpSI/AAAAAAAAESY/PhG66jWB1OA/s200/blogger-featured-slideshow.png" title="Blogger Logo" class="miniimg"/&gt; &lt;img src="http://2.bp.blogspot.com/-BKPnpE6QpfY/TewL7Q16ipI/AAAAAAAAERg/pxn6NY1nNsg/s640/best-blogger-template-stunning-slider-magazine.PNG" title="blogger template" class="miniimg2"/&gt; &lt;img src="http://4.bp.blogspot.com/-gxaZr19LXtY/TdRcJrxv3gI/AAAAAAAAD68/KaX9UN0B2nE/s640/advanced-design-magazine-blogger-template.PNG" title="another blogger template" class="miniimg3"/&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload