I have a problem to add the dynamic values to a string.
For example:
My name is < NAME >
Now I want to replace NAME with my name so my string will become:
My name is anything.
How I can achieve this?
The dynamic part will be always between <>.
do you want this? Or are you searching for something more complex that enums all the words between
< and >? Something like:If you want to replace multiple parts you could do this:
Test here:
http://jsfiddle.net/rZuNX/
A more complete example:
I’m using javascript anonymous functions that “close” around the
nameandsurnamevariables.Test it here: http://jsfiddle.net/rZuNX/1/