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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:27:34+00:00 2026-06-06T11:27:34+00:00

On a page with several urls I want to be able to remove the

  • 0

On a page with several urls I want to be able to remove the whitespace in the slug and replace it with a hyphen.
I can case where I have a single url, but I’m having trouble with multiple url case.
I assume the script must use each(function())
Based on the version I used for the single version I tried the following:

$(document).ready.(function() {
        $('a.testlink').each(function() {
            var Text = $(this);
            Text = Text.toLowerCase();
            Text = Text.replace(/[\s]+/g,'-');
            $(this).attr("href", Text);      
    });
         });

But the script fails completely having no effect on the url – it neither makes lower case nor replaces the whitespace.

How do I get the script to loop over each href and replace any spaces found in the slug.

  • 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-06T11:27:35+00:00Added an answer on June 6, 2026 at 11:27 am

    I believe the line that says var Text = $(this); should be var Text = $(this).attr("href");

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

Sidebar

Related Questions

I have a page with several .desc divs. I want to add some html
I have a page with several Update Panels on it. the url of that
I have a page of several videos. One can click a thumbnail to play
I have several URLs that I want to redirect to the same place, however
I have a page with several CheckBoxList controls with 4 checkboxes in each of
I have a page with several tables on it with the same class name.
I have an AngularJS page with several form inputs. When the some of the
I have heavy HTML-page with several megabytes of images and scripts. I'd like to
I receive a list of image URLs and currently I have several hidden img
I have a page showing several thumbnail images. When the user mouseovers these images,

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.