Good evening.
How in javascript can I replace all the characters with the ones I need? I pull out albums from Facebook, and it allows me to write ' and ' in the title of the album. Naturally on my website this results in a problem. That's what I tried:
function clearFromSlashes(str){ var slashes1="\'"; //заменяем одинарные кавычки var slashes2="\""; //заменяем двойные кавычки var newStr=str.replace(slashes1," "); return newStr.replace(slashes2," "); }
This function replaces only the very first quotes, if further in the title quotes are found again, the function skips them. How to catch them too? And .. as you see, I made 2 variables slashes1 and slashes1, for some reason, if I wrote like this:
var slashes1="\',\""; - оно не работало.. не знаю почему