Javascript examples for String Operation:String Replace
replace backslashes in string through JavaScript, / to \
<html> <head> <title></title> </head> <body> <p id="p1">Original: </p> <p id="p2">Modified: </p> <script> var Str = '..\\..\\..\\folder\\folder'; console.log(Str); document.getElementById('p1').innerHTML += Str; Str = Str.replace(/\\/gi,'/'); console.log(Str); document.getElementById('p2').innerHTML += Str; //from www .j a v a 2 s .c o m </script> </body> </html>