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

  • Home
  • SEARCH
  • 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 8185417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:50:27+00:00 2026-06-07T01:50:27+00:00

I am trying to retrieve the source of an image depending on which separate

  • 0

I am trying to retrieve the source of an image depending on which separate image the user previously clicked on.

<div class="card1">
    <div>
    <a href="#" class="quickFlipCta"><img class="back" src="Memory Pals/Test Pictures/QuestionMark.gif" /></a>
    </div>

    <div>
    <a href="#" class="quickFlipCta"><img class="front" src="Memory Pals/Test Pictures/flower.gif" /></a>
    </div>
</div>

<div class="card2">
    <div>
    <a href="#" class="quickFlipCta"><img class="back" src="Memory Pals/Test Pictures/QuestionMark.gif" /></a>
    </div>

    <div>
    <a href="#" class="quickFlipCta"><img class="front" src="Memory Pals/Test Pictures/flower.gif" /></a>
    </div>
</div>

In my specific example, I am trying to retrieve the source of “front” when “back” is clicked. Also, it must retrieve the source of “front” in the same card.

This is what I’ve tried, but I can’t get it to work:

$(document).ready(function(){

        var found = 0;
        var last = null;

        $('img').each(function(index){
          $(this).attr('id','img-' + index);
        });    

        $('img').click(function(){
          if( last ) {
            if( ($(this).attr('src') == last.attr('src')) ) {
              $(this).css('visibility', 'hidden');
              last.css('visibility', 'hidden');
              found++;
            }
            if (found == 3) {
            window.location.href = "#play2"; 
            location.reload(); //resets found to 0
            }
            last = null;
          } else {
            last = $(this);
          }
        });

I realize it is not retrieving the source of “front,” just the source of an image that the user has clicked on. How can I change it so it retrieves the source of “front” when “back” is clicked?

  • 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-06-07T01:50:30+00:00Added an answer on June 7, 2026 at 1:50 am

    Here is something that may point you in the right direction:

    $('img.back').click(function () {
        var frontSrc = $('img.front').first().attr('src');
        alert('The source for \'front\' is ' + frontSrc);
        }
    }); // end .click handler
    

    Use the hasClass jQuery function to find out whether or not the element you’ve clicked on has the ‘back’ class. Then use the img.front selector to find the image with the front class and retrieve it’s source.

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

Sidebar

Related Questions

I am trying to retrieve the image source of an image that the user
Im trying to grab a HTML source code from a webpage which needs user
I am trying retrieve user name from the code through graph api, the below
Hi I am trying to retrieve values from database. I have a row which
I've downloaded the source of Soundflower and I am trying to retrieve a list
I am trying to retrieve the image from resource file and tryin to bind
I was trying to retrieve wall posts for a particular user, similar question has
I am being a company firewall, and I am trying to retrieve Webkit source
I'm trying to retrieve some remote XML from another source using PHP. I understand
I'm trying to retrieve the source of a webpage, including any images. At the

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.