Javascript Strings: How to Do String Replacement in JS
Friday, February 22nd, 2008This morning I set about making a simple script to clean extra newline characters out of text. I could easily have processed the form contents in PHP, but I wanted to use Javascript to avoid reloading the page.
The concept seemed simple enough, but I ran into a problem – I didn’t know how to do string replacement in Javascript. The first thing I thought was, “What is the Javascript equivalent to str_replace?”
(more…)