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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:31:12+00:00 2026-05-23T06:31:12+00:00

On my web pages I have source that looks like this: <div id=opt_3 >A)</div>

  • 0

On my web pages I have source that looks like this:

<div id="opt_3"  >A)</div>
<div id="opt_2"  >B)</div>
<div id="opt_4"  >C)</div>
<div id="opt_5"  >D)</div>
<div id="opt_1"  >E)</div>

What I need is to create a javascript that when running takes something like this as an input var:

Text 1 word word word this is a text 3 word word.

and changes it to

<strong>E</strong> word word word this is a <strong>A</strong> word word.

or

abc text 4 word 

and changes it to

abc <strong>C</strong> word

The job of my javascript will be to taken the number inside of the string “Text X” or “text X”, look at the first character of the id field that matches the value of X and substitute that character for “Text X”.

I have jQuery loaded. Can that help by giving me some suggestioins? Do I need to use javascript as well as jQuery?

Can someone give me some advice on how I could do this. I am not very familiar with javascript or with jQuery.

  • 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-23T06:31:12+00:00Added an answer on May 23, 2026 at 6:31 am

    For this you will need jQuery

    
    //get the original text
    txt = $('#text-container').text();
    //split the whole text by the words "Text"
    // this way each string in the array arr will contain as its first member the number 
    // without the splitting text
    arr = txt.split('Text');
    answerText = '';
    for(i=0; i < arr.size(); i++){
        words=arr[i].split(' '); //split by spaces
        //the first word will be the number
        nr = words[0];
        //then we look up the corresponding option, and substitute the number
        words[0] = $('#opt_'+nr).text();
        //and rebuild the original text
        answerText += words.join(' ');
    }
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of ASP.NET web pages (that have a standard layout) that
I'm programming in PHP and would like to create web pages which have email
I have several web pages on several different sites that I want to mirror
I have a text in the database that looks like that: 69&lt;sup&gt;something&lt;/sup&gt; And when
I have a PHP/jQuery scraper function that essentially looks for web page content. One
I have a jsp that contains a css link that looks like <link type=text/css
I have seen a web page source code containing the following css declaration at
I have 3 filter conditions on a web page Filter by dropdown Source Filter
I visited Avis.com, and I notice the web pages have *.ac extension. Not familiar
We have some web pages which have two frames, with one frame in the

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.