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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:05:51+00:00 2026-06-03T02:05:51+00:00

running into a little issue, can’t quite figure it out. I’m using jQuery on

  • 0

running into a little issue, can’t quite figure it out. I’m using jQuery on a page to handle some image loading and lightboxing. Part of the feature set requires replacing a portion of an anchor tags href to direct it towards a different resource.

there are a variable amount of images in the set, so I’m using jQuery’s .each() method to grab them, replace part of the url, then fade them in one after the order. The fading works correctly, but JavaScript’s .replace() isn’t taking effect (though if i turn them into a variable and log it i see the correct results) and if i chain the fade in function to the back of .replace it doesn’t get executed.

feels like the value isn’t being returned to the elements. what am i missing?

thanks for your help!

HTML:

<a class="test" href="aresourcewithextension_b.jpg">
    <img src="aresourcewithextension_a.jpg" />
</a>

JavaScript:

$('.test').each(function(i){
    $(this).attr('href').replace('_b.jpg','_c.jpg').delay(100*i).animate({opacity:1},200);
});
  • 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-03T02:05:53+00:00Added an answer on June 3, 2026 at 2:05 am

    You need to set the replaced href. .replace itself won’t update the original string.

    Try like below,

    this.href = this.href.replace('_b.jpg','_c.jpg');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running into some little glitch on Internet Explorer. The site looks like it
I'm a little confused with an issue that I keep running into. I'm trying
I'm converting an old AS1 project to AS3 and am running into a little
I am creating a little testing component and am running into a problem Basically
I'm running into a bit of a problem using the css content property to
So I'm running into a bit of an issue here with wsdls and selecting
I'm running into some difficulties getting output from a subprocess stdout pipe. I'm launching
I'm writing a JAX-WS WebService but I am running into a little stumbling block
So I've been running into some speed issues with my site which has been
I am running into a strange issue. I have a dropdown list that contains

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.