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 6544157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:25:56+00:00 2026-05-25T11:25:56+00:00

I have a product page that has image thumbnails and links bellow for front

  • 0

I have a product page that has image thumbnails and links bellow for front cover and back cover to change the thumbnails. The problem is that when you click on those links to change the thumbnails ALL the image for the rest of the product thumbnails change as well.
How can I bind the click event to that product so only that thumbnail is changed?

This is my HTML (this list is repeated bellow for other products with different images):

<div class="product-main-image">
    // Here I have the thumb image
    <a href="Images/cards/us-sip-connect-5-front-hi-res.jpg" class="product-main-image-hover">
        <img src="Images/cards/us-sip-connect-5-front.jpg" class="product-image" />
    </a>
    // When I click front or back links it's changing all the thumbs for other product as well.
    <ul class="thumbs">
        <li><a href="Images/cards/front.jpg" rel="Images/cards/front-hi-res.jpg">Front</a></li>
        <li><a href="Images/cards/back.jpg" rel="Images/cards/back-hi-res.jpg">Back</a></li>
    </ul>
</div>

This is the jQuery:
$('.thumbs a').live('click', function(){  
   // Get the thumb image tag attributes
    var image_thumb = $(this).attr("href");
    var image_hi_res = $(this).attr("rel");

    // switch the image by removing the node and re-writing in the neccessary HTML
    $('.product-main-image-hover').remove();
$('.product-main-image').append('<a href="' + image_hi_res + '" class="product-main-image-hover"><img src="' + image_thumb + '" class="product-image" /></a>');
return false;
  });

Hope someone can lead me in the right direction. Thanks.

  • 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-25T11:25:57+00:00Added an answer on May 25, 2026 at 11:25 am

    $('.product-main-image-hover') will select all the elements which have that class. So remove method on it will remove all the elements on the page. You need to basically find it within the current product. You can use jQuery closest method to find the product images container and then find the required element and remove. append will append the elements at the end of it so in this case you have to use prepend since you have to replace the image at the same location.

    $('.thumbs a').live('click', function(){  
       // Get the thumb image tag attributes
        var image_thumb = $(this).attr("href");
        var image_hi_res = $(this).attr("rel");
    
        var productMainImage = $(this).closest('.product-main-image');
    
        // switch the image by removing the node and re-writing in the neccessary HTML
        productMainImage.find('.product-main-image-hover').remove();
    
        productMainImage.prepend('<a href="' + image_hi_res + '" class="product-main-image-hover"><img src="' + image_thumb + '" class="product-image" /></a>');
    
         return false;
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that will have a full size product image and 4
I currently have a product view page that contains an MVCContrib HTML Grid with
I have the following URL which links to the product page of a Mac
So I have a html page that has a form, and a table inside
I have a page that has primarily dynamic content generated by Ajax . It
I have product panels on a cart-view page where the user can click an
I have an online store. A products page that allows the user to view
I have a product listing page and want to load up a detail view
I have an edit page with url example.com/product/edit/11 Now if the validation is false
In a Master page, I have this.... <ul id=productList> <li id=product_a class=active> <a href=>Product

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.