admin管理员组

文章数量:1389841

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
Add a ment  | 

3 Answers 3

Reset to default 4
placeholder = placeholder.replace("$","£");

Simples!

Really?

JavaScript Replace

var myNewString = myOldString.replace("something", "new thing");

placeholder = "<strong>Total Damage:</strong> $70,000.00".replace("$","£");

本文标签: How to change single char from string in JavaScriptStack Overflow