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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:53:08+00:00 2026-06-04T16:53:08+00:00

How can I remove text from a static URL inside a loaded document. For

  • 0

How can I remove text from a static URL inside a loaded document. For example.. I have..

<a href="mylink.html#something">My Link</a>

How can I remove #something from that href using jQuery? So it would then display as..

<a href="mylink.html">My Link</a>

Also if it helps.. I can’t remove anything containing # because what I am doing is adding another hashtag in place of it. The problem is I am getting a result like the following…

<a href="mylink.html#something#somethingelse>My Link</a>

EDIT

My jQuery…

$('ul li a').each(function () {
   $(this).prop("href", $(this).prop("href") + "#something");
});

What I would like to do..

$('ul li a').each(function () {
   //remove #something from href if it is already there and replace with #somethingelse
   $(this).prop("href", $(this).prop("href") + "#something");
});
  • 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-04T16:53:10+00:00Added an answer on June 4, 2026 at 4:53 pm

    @VisioN .. Thanks for your help. But this is what I was looking for.

    var changeHref = $('ul li a').attr("href").replace(/#something/, "#somethingelse");
    $('ul li a').attr("href", changeHref); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I remove text from between square brackets and the brackets themselves? For
How can I remove a whole line from a text file if the first
I have string like this: G:\Projects\TestApp\TestWeb\Files\Upload\file.jpg How can I remove all text before Files
I have the text: SMS \r\n\t• Map - locations of How can I remove
<div class=example>Some example text</div> <div class=example>Some more example text</div> How can I remove all
I have a text <info>SOME CONTENTS GOES HERE</info> How i can remove this text
How to I can remove posts from a specific category from homepages in wordpress?
I am trying to remove text from a dropdown menu using a Jquery plugin
Can anyone explain how to remove a child item from my expandable list under
I wish to remove text from a string from the first non-allowable character on.

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.