Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
09-23-2012, 03:10 PM #1
- Join Date
- Oct 2011
- Thanked 0 Times in 0 Posts
Replace text on CURRENT page with text entered in form ONCLICK
I did a search here and couldn't find exactly what I was looking for.
Basically, I have a page that I'd like to add a little feature too.
At the top of the page, would be a form, with a single text field and a submit button.
When the submit button is clicked, all instances of XXXX on the current page would be automatically replaced with whatever was entered in the text field.
Let's say on a page, the form would say "enter name here" and a 'submit' button...
Now just for the sake of simple example, I have several sentences on this current page.
Hi my name is XXXX
His name is XXXX
Would you like to meet XXXX
I need XXXX replaced on the current page with the text entered in the form when the submit button is clicked.
So if I had entered Adam in the form, the resulting sentences would dynamically change to,
Hi my name is Adam
His name is Adam
Would you like to meet Adam
To be more specific, I don't want to send people to a NEW page when the submit button is clicked, I want the existing XXXX on the current page to be replaced with the new text when the submit button is clicked.
Last edited by addcode; 09-23-2012 at 03:31 PM.
09-23-2012, 08:20 PM #2
- Join Date
- Jun 2002
- London, England
- Thanked 2,573 Times in 2,551 Posts
Here you are:-
"In the beginner's mind there are many possibilities, but in the expert's mind there are few” - Shunryu Suzuki (Japanese Zen priest, ?-1971)
Last edited by Philip M; 09-23-2012 at 08:22 PM.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.