Javascript replace issue with $
javascript
Solution
Have a look at the MDN documentation:
The replacement string can include the following special replacement patterns:
`$$` `Inserts a "$".`
So you have to do:
adHtmltext.replace("this", "$$$$Ashok");
See also Javascript string replace weirdness -- $$$$ gets collapsed to $$ -- what's the reason behind this result?.
Problem
I am trying to replace "this" in the below example with "$$Ashok".I am not getting expected output. ``` var adHtmltext ="this is ashok" adHtmltext = adHtmltext.replace("this", "$$Ashok"); alert(adHtmltext ); ``` why it is showing one $ in output? how to fix this? Here is the jsfiddle http://jsfiddle.net/RxDa5/ Please help.