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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:18:37+00:00 2026-05-25T13:18:37+00:00

<span id=one><a id=google href=google.com/>link1</a></span> <br /> <span id=two><a id=yahoo href=yahoo.com/>link2</a></span> <br /> <br />

  • 0
<span id="one"><a id="google" href="google.com/">link1</a></span> <br />
<span id="two"><a id="yahoo" href="yahoo.com/">link2</a></span>

<br />
<br />
<span class="click" id=1>click one</span> <br />
<span class="click" id=2>click two</span> <br />
<span class="click" id=3>click three</span> <br />

$(".click").live('click', function() {    
   $("a").attr('href', $("a").attr('href').replace(/\d*$/, $(this).attr('id')));
});

If I click for example click one then links are:

<span id="one"><a id="google" href="google.com/1">link1</a></span> <br />
<span id="two"><a id="yahoo" href="google.com/1">link2</a></span>

instead of:

<span id="one"><a id="google" href="google.com/1">link1</a></span> <br />
<span id="two"><a id="yahoo" href="yahoo.com/1">link2</a></span>

LIVE EXAMPLE: http://jsfiddle.net/wtAbp/14/

How can I fix it?

  • 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-25T13:18:37+00:00Added an answer on May 25, 2026 at 1:18 pm

    Here is working sample http://jsfiddle.net/wtAbp/18/

    $(".click").live('click', function() {  
        var $id = $(this).attr('id');
        $("a").each(function() {
            $(this).attr('href', $(this).attr('href').replace(/\d*$/, $id));
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have: <span id=test><a href=google.com/>link1</a></span> <br /> <br /> <span class=click id=1>click one</span> <br
<span id=one> one </span> <span id=two> two </span> $(#one).mouseover(function(){ $(this).css('background-color', 'red'); }); $(#two).click(function(){ $(this).css('background-color',
i need a regex to replace a string. <span class=\Translation\ lang=\ThisLanguage\> with this one:
I am using jQuery UI Tabs . <div id=tabs> <ul id=tablist> <li><a href=#fragment-1><span>One</span></a></li> </ul>
I try to implement the following code: <a href = http://www.google.com/ id=external>go to google</a>
I try to implement the following code: <a href = http://www.google.com/ id=external>go to google</a>
<fieldset style=background-color:#5959DE> <span> <a href=page2.html> <strong> Profile </strong> </a> </span> <span class=profilee> <a href=page2.html>
<span class='python'> <a>google</a> <a>chrome</a> </span> I want to get chrome and have it working
I expected the two span tags in the following sample to display next to
I have two span elements that I would like to stay on the same

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.