Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7007649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:38:04+00:00 2026-05-27T21:38:04+00:00

JSFIDDLE HERE On pressing a .miniimg/2/3 it should replace the src of an img

  • 0

JSFIDDLE HERE
On pressing a .miniimg/2/3 it should replace the src of an img classed .presentimg which i have appended using jquery to the div .imgcontainer, I have been through the jQuery (BELOW HTML) and the only reason i think it wont work because of the fact i have used a function within a function and i do not know an alternative method

<div class="imgcontainer">
    <div class="minicontainer">
    <img src="http://lh3.googleusercontent.com/_Zuzii37VUO4/Ta0nUeMwXoI/AAAAAAAAFoc/7f0Um7OTgNg/s000/Antartic-by-Peter-Rejcek.jpg" title="icy mountains" class="miniimg"/>
    <img src="http://lh3.googleusercontent.com/_Zuzii37VUO4/Ta0nUFUhg6I/AAAAAAAAFoY/GToUxRYcteY/s000/Antartic-by-Kelly-Speelman.jpg" title="icy planes and hills" class="miniimg2"/>
    <img src="http://lh4.googleusercontent.com/_Zuzii37VUO4/Ta0nTs8AbPI/AAAAAAAAFoU/zCvNKv4kfe4/s000/BeachWaves-By-RePublicDomain.jpg" title="sun rise with clouds" class="miniimg3"/>
    </div>
</div>

The jquery, in the jquery I use (index) for the outer .each function as i saw it on a forum but i dont not know if that actually works unfortuately

$(".imgcontainer").each(function(){
    var imgsrc = $(".minicontainer img:first-child").attr("src");
    $(this).append('<img src="'+imgsrc+'" class="presentimg"/>');
});
$(".miniimg").each(function(index){
    var $this = $(this);
    $(this).click(function(){
        var miniimgrc = $this.attr("src");
        $(".presentimg").atrr('src', miniimgrc);
    });
});
$(".miniimg2").each(function(index){
    var $this = $(this);
    $(this).click(function(){
        var miniimgrc2 = $this.attr("src");
        $(".presentimg").atrr('src', miniimgrc2);
    });
});
$(".miniimg3").each(function(index){
    var $this = $(this);
    $(this).click(function(){
        var miniimgrc3 = $this.attr("src");
        $(".presentimg").atrr('src', miniimgrc3);
    });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:38:05+00:00Added an answer on May 27, 2026 at 9:38 pm

    Actually, I think your problem is that you have several misspellings of attr:

    $(".presentimg").atrr('src', miniimgrc3);
    

    should be:

    $(".presentimg").attr('src', miniimgrc3);
    

    Updated fiddle: http://jsfiddle.net/nv9em/

    Additionally, you can shorten your code to just one event handler:

    $(".imgcontainer").each(function() {
        var imgsrc = $(".minicontainer img:first-child").attr("src");
        $(this).append('<img src="' + imgsrc + '" class="presentimg"/>');
    });
    
    $(".miniimg, .miniimg2, .miniimg3").click(function() {
        var miniimgrc = $(this).attr("src");
        $(".presentimg").attr('src', miniimgrc);
    });
    

    Updated fiddle: http://jsfiddle.net/Fr5yW/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jsFiddle here : http://jsfiddle.net/ZXDYS/22/ I am creating Blogger post summaries using
So here is the issue, I have 6 divs that are using jQuery UI
jsFiddle here. I'm toggling a div's height using JQuery 1.5.2, and it mostly seems
I have created a quick jsfiddle here showing it not working. The problem I
http://jsfiddle.net/motocomdigital/c8Mey/1/ I'm using a twitter script which i'm binding a function to get the
I have a JsFiddle here , and added Microsoft AJAX to be loaded through
I have two li elements which are jQuery draggable. When I drag and drop
jsfiddle here (updated) What i have is a bunch of sets of images (like
See jsfiddle here The selector highlights all tables rather than the one it should
This is my tabbed interface, I have a jsfiddle here . <div class=tabs> <!--

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.