I need to replace all double quotes to single quotes using jquery.
我需要用jquery将所有双引号替换为单引号。
How I will do that.
我该怎么做。
I tested with this code but its not working properly.
我用这段代码进行了测试,但是没有正常工作。
newTemp = newTemp.mystring.replace(/"/g, "'");
newTemp = newTemp.mystring。替换(/ / g,“”);
1 个解决方案
#1
76
Use double quote to enclose the quote or escape it.
用双引号将引号括起来或者转义。
newTemp = mystring.replace(/"/g, "'");
or
或
newTemp = mystring.replace(/"/g, '\'');
#1
76
Use double quote to enclose the quote or escape it.
用双引号将引号括起来或者转义。
newTemp = mystring.replace(/"/g, "'");
or
或
newTemp = mystring.replace(/"/g, '\'');