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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:04:40+00:00 2026-05-12T14:04:40+00:00

I have a bunch of textarea’s on a page with copy and paste codes

  • 0

I have a bunch of textarea’s on a page with copy and paste codes with urls inside them.

for exmaple:

<textarea><a href="http://anything.domain.com/x/5">something</a></textarea>
<textarea><a href="http://anything.domain.com/x/3">something</a></textarea>

I also have a dropdown, with a bunch of subdomain options with the intent of changing the subdomain inside all the textareas on the page.

e.g

<select class="changeLinks">
    <option value="www">www.domain.com</option>
    <option value="somethingelse">somethingelse.domain.com</option>
</select>

How to go through these textareas and just update the text of the subdomain?

$('.changeLinks').change(function(){

    var subdomain = $(this).val();

 // *blank* some sort of find and replace function which replaces whatever is after the http:// and before the first decimal with the var subdomain


});
  • 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-12T14:04:40+00:00Added an answer on May 12, 2026 at 2:04 pm

    You could use regular expression to find and replace all the links in the text:

    var text = $("textarea").each(function(){
      $(this).text($(this).text().replace(/<a href="http:\/\/\w+\.domain\.com(.*?)">(.*?)<\/a>/gi, "<a href=\"http://"+subdomain+".domain.com"+$1+"\">"+$2+"</a>"));
    });
    

    I haven’t tested the function, but it should work. It might need some tweaking and bugfixing.

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

Sidebar

Related Questions

I have bunch of python-projects with untrusted WSGI-apps inside them. I need to run
I have a bunch of buttons that have a tapGestureRecognizer linked to them, and
I have a page that dynamically generates any number of divs.  Inside the div
I have a page which contain a bunch of text area generated by a
I have a textarea that accepts a bunch of data. I then submit it
I have bunch of urls. By using regex pregmatch I want to find the
I have bunch of location (Lat, Lng) data inside my database and let's assume
I currently have a page with a bunch of lists, where each list has
I have bunch of topics inserted in database, now I want to print them
I have a 2 select dropdowns each of them have bunch of elements (just

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.