jQuery: How to escape single and double quotes with backslash

后端 未结 0 806
暖寄归人
暖寄归人 2021-02-13 07:59

I want to escape single and double quotes with a backslash in one line rather than two.

Example for single quote:

str = str.replace(/\'/g, \"\\\\\'\");
<         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题