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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:31:12+00:00 2026-06-04T14:31:12+00:00

For example, want to modify all href value from yahoo.com to google.com I tried:

  • 0

For example, want to modify all href value from yahoo.com to google.com

I tried:

$("[href='http://yahoo.com']").val('http://google.com');

It won’t work, what is the correct way to do so?

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-06-04T14:31:14+00:00Added an answer on June 4, 2026 at 2:31 pm

    If you wish to replace the “yahoo.com” portion of any href with “google.com”:

    $("[href*='yahoo.com']").attr("href", function(i,v){
      return v.replace("yahoo.com", "google.com");
    });
    

    This works by cycling through all elements that have “yahoo.com” anywhere in their href attribute, and replacing that string with “google.com”.

    ​<a href="http://yahoo.com">Yahoo</a>
    <a href="http://www.yahoo.com">www.yahoo.com</a>
    <a href="http://yahoo.com?foo">Yahoo?</a>​​​​​​​​​​​​​​​​​
    

    Becomes

    ​<a href="http://google.com">Yahoo</a>
    <a href="http://www.google.com">www.yahoo.com</a>
    <a href="http://google.com?foo">Yahoo?</a>​​​​​​​​​​​​​​​​​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

for example : I want to remove all highlighted tags alt text http://shup.com/Shup/299976/110220132930-My-Desktop.png
I want real example about dynamic site map take it's value from database
I want to round a value in Twig. Example: I want to display 80.5555
I want to modify all the text nodes using some functions in C#. I
For example, let's say I want to modify the breadcrumbs block of the admin/change_list.html
I am getting all events, with a certain attribute, and I want to modify
I am using the following http://www.ibm.com/developerworks/opensource/library/x-phpgooglecontact/index.html to authenticate to Google and retrieve a users
I am a newbie at Groovy and I want to modify one example I've
I want to wrap and modify the response to an HTTP request to my
For example: I want: if file1 exists: CLEAN_SRC = *.h file3 else CLEAN_SRC =

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.