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.
For this you will need jQuery