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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:41:54+00:00 2026-05-13T01:41:54+00:00

I need a way to go through all the text on my page, including

  • 0

I need a way to go through all the text on my page, including links and other controls and find words that are in a certain list and add the html character entity ™ (™) to them.
I need this to be fast too.
The list is held in a javascript array. I’ve already got code using .each to find all Links on the page with text from that list, but it’s noticeably slow and I don’t like that.

Any better, more efficient ways to do this?

EDIT

People are suggesting other alternatives (server-side, css, etc.)
We can’t use those because these words are in URL’s all over the site. We would mess up our URL’s all over the site. We are using DotNetNuke to do this and the client just told us today that every time their products appear on the entire site (including links) they want them to be in all caps and have TM appended.
If we change the products in the database, all the links suddenly have “trade” appended to the end of them.
The nature of DNN says that we can’t do this server-side.
We could go through and manually change it in each page…but the site is 1,900+ pages……
SO! Client side is the route we want to go.

  • 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-13T01:41:55+00:00Added an answer on May 13, 2026 at 1:41 am

    Do a regex search/replace. In theory, this should be faster than marcgg’s method since you are touching DOM only once.

    var wordList = ["jQuery UI", "jQuery", "is"];
    var regExp = new RegExp("\\b" + wordList.join("\\b|\\b") + "\\b", "g");
    var $elem = $("#divWithText");
    console.log(regExp);
    $elem.html($elem.html().replace(regExp, "$&™"));
    

    Caveat:

    1. This will also nuke any scripts that may be inside the div since the script elements are not re-parsed.
    2. Same applies to any html tag that matches your regex.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm bumbling my way through creating a Silverlight 3 application. I need some high
Friends, I have a strange need and cannot think my way through the problem.
I need a way to take text from a EditText as soon as the
I have a small front end to a webshop. All customers that go through
I have a multi-browser page that shows vertical text. As an ugly hack to
I'm loading a portion of an HTML page into a text area so that
I have a 1.3GB text file that I need to extract some information from
I need a way to change the specific value of a column of a
I need a way in my Chrome extension to know when the browser is
it need a way to call function whose name is stored in a string

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.