Categories
jquery replace string

How to replace all double quotes to single quotes using jquery?

I need to replace all double quotes to single quotes using jquery.

How I will do that.

I tested with this code but its not working properly.

newTemp = newTemp.mystring.replace(/"/g, "'");

Use double quote to enclose the quote or escape it.

newTemp = mystring.replace(/"/g, "'");

or

newTemp = mystring.replace(/"/g, '\'');