Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
52
rated 0 times [  57] [ 5]  / answers: 1 / hits: 30031  / 10 Years ago, mon, june 30, 2014, 12:00:00

I have a variable in my script,


var st = ""

In that quotes I have to give a string and this string contains lot of single and double quotations.


I think there isn't any problem with single quotations, but a problem with the double quotes (") only.


In this I can't manually replace " for all, even I tried with an editor that " replace with ", but it's not working.


More From » html

 Answers
15

You will need to use regular expression for this,


st.replace(/"/g, '\"');

Check out more on regular expressions here.


[#70378] Friday, June 27, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kiley

Total Points: 733
Total Questions: 118
Total Answers: 94

Location: Liechtenstein
Member since Wed, Dec 8, 2021
3 Years ago
;