Possible Duplicate:
Why does javascript replace only first instance when using replace?
I have this variable
var newRow = "<td><div> [[myvar]]</div> <div> [[myvar]]</div> </td> "
When i do this
newRow = newRow.replace('[[myvar]]', '10');
Only first occurance gets replaced and not the second
You might use a regular expression
There is no other simple solution for multiple replacements. Note that :
/\[\[myvar\]\]/notationnew RegExp(somepattern, 'g')(but for better performances don’t use this if you have a fixed pattern)