I would like to replace all occurences of a particular string with $$ in javascript.
However when I attempt the replace it only replaces a single character http://jsfiddle.net/PrZ9y/
text = "sfsd";
text =text.replace(/sf/gi,"\$\$");
document.getElementById("x").innerHTML=text;
This for example outputs $sd
. The correct output should be $$sd
I also tried
text =text.replace(/sf/gi,"$$");