How to replace all double quotes (") instance from a javascript variable string?
Here's my code
var double_quote_with_string = "Test "Double Quote" Test";
var replace_double_quote = double_quote_with_string.replace(/"/g, "\"");
alert(replace_double_quote);
I want the alert result should be - Test "Double Quote" Test
Here's the fiddle - https://jsfiddle.net/k1maf209/1/ (this is not working)
Any idea?
When you try this,
this is syntactically incorrect. If you want quotes in your string try enclosing it in single quotes
'
,Or use escape character
\
check this fiddle. I have replaced all the double quotes with single quotes.
edited fiddle