This might be a strange idea, hopefully it’s possible. I have a script that dynamically loads a div with different text values (this is a given variable, can’t change anything here). Is it possible to change these values after the page has loaded? This is my idea:
- The page is loaded
- The script loads the div with text (e. g. one phrase is “Welcome here”
- New script changes some of the values displayed (e. g. the previous one becomes “How are you? Welcome!”
Any ideas?
EDIT
Here is the example of the code:
<div id="one" class="one">First text
<div class="two">Second text
<label class="three">Third text</label>
<option value="1">ValueOne</option>
<a>Link text</a>
</div>
</div>
As you can see, there are different types of selectors involved, while some of the phrases don’t have any selectors (this is just a part of the code). After the page loading finishes, this shoud look like this:
<div id="one" class="one">FirstTextChanged
<div class="two">SecondTextChanged
<label class="three">ThirdTextChanged</label>
<option value="1">ValueOneChanged</option>
<a>LinkTextChanged</a>
</div>
</div>
http://jsfiddle.net/UPhUb/1/
waits 5 seconds after page loads, then changes the text. Simple.
Updated per your comment: now when you call
changeTextyou pass two arguments, the text you want swapped out and the new text you want in. Without seeing your code, this is as close as I think I can get.