Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change single char from string in JavaScript

Tags:

javascript

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

like image 415
CuriousMind Avatar asked Feb 28 '26 17:02

CuriousMind


2 Answers

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

Simples!

like image 54
Jamiec Avatar answered Mar 03 '26 05:03

Jamiec


Really?

JavaScript Replace

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

like image 30
Jordan Avatar answered Mar 03 '26 07:03

Jordan