I have a variable which contains the following string
placeholder = "<strong>Total Damage:</strong> $70,000.00"
Now, I am trying to replace Dollor sign($) with pound sign(£). Any idea how this can be done?
[Edit]
I don't know javascript, still trying to learn. now the solution seems so simple, I feel embarrassed now. Sorry for bothering everyone with such silly question :(
I have a variable which contains the following string
placeholder = "<strong>Total Damage:</strong> $70,000.00"
Now, I am trying to replace Dollor sign($) with pound sign(£). Any idea how this can be done?
[Edit]
I don't know javascript, still trying to learn. now the solution seems so simple, I feel embarrassed now. Sorry for bothering everyone with such silly question :(
Share Improve this question edited Jan 11, 2012 at 16:27 CuriousMind asked Jan 11, 2012 at 16:19 CuriousMindCuriousMind 34.2k29 gold badges100 silver badges141 bronze badges 3-
3
Googling
javascript replace character
should give you everything you need. – Pekka Commented Jan 11, 2012 at 16:20 - 1 possible duplicate of Javascript replace a character with a space – Rob Hruska Commented Jan 11, 2012 at 16:24
- Also see this answer – Rob Hruska Commented Jan 11, 2012 at 16:25
3 Answers
Reset to default 4placeholder = placeholder.replace("$","£");
Simples!
Really?
JavaScript Replace
var myNewString = myOldString.replace("something", "new thing");
placeholder = "<strong>Total Damage:</strong> $70,000.00".replace("$","£");
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744741673a4591063.html
评论列表(0条)