MrAntunes
11/16/2015 - 3:22 PM

replace

replace

var s = $(this).val();
while (s.indexOf("\n") > -1) s = s.replace("\n"," ");
$(this).val(s);     
You can use RegExp with g flag.

var mystring = "this,is,a,test"
mystring.replace(/,/g , "newchar");