2

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 :(

3
  • 3
    Googling javascript replace character should give you everything you need. Commented Jan 11, 2012 at 16:20
  • 1
    possible duplicate of Javascript replace a character with a space Commented Jan 11, 2012 at 16:24
  • Also see this answer Commented Jan 11, 2012 at 16:25

3 Answers 3

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

Simples!

Sign up to request clarification or add additional context in comments.

Comments

3

Really?

JavaScript Replace

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

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.