Tuesday, 6 August 2013

javascript replace() is not replacing all the characters match

javascript replace() is not replacing all the characters match

I want to turn /Admin/ListOfMovies into _Admin_ListOfMovies using replace().
var $id = id.replace('/', '_');
It looks like it only replacing the first /. How do I replace all of them?
Thanks for helping.

No comments:

Post a Comment