144
rated 0 times
[
146]
[
2]
/ answers: 1 / hits: 20970
/ 14 Years ago, mon, january 24, 2011, 12:00:00
I wanna replace several words in a text using replace()
in javascript, how can I do that?
For example, if I wanna replace, 'Dave Chambers, David Chambers, Will Smith' with 'Jackie Chan', no matter if they're in upper-case or lower-case, do I have to keep repeating the replace()
method on the same string variable everytime, i.e.
var str = sometext.innerHTML;
str.replace('Dave Chambers', 'Jackie Chan');
str.replace('David Chambers', 'Jackie Chan');
str.replace('Will Smith', 'Jackie Chan');
More From » string