How can I accommodate a string with both single and double quotes inside of it in JavaScript

前端 未结 4 1392
礼貌的吻别
礼貌的吻别 2020-12-03 15:12

I have an application, and it is fed some HTML. It then needs to put that HTML into a string. This HTML contains single and double quotes. Is it possible, in javascript, to

4条回答
  •  一向
    一向 (楼主)
    2020-12-03 15:35

    You need to escape the quotation characters with \:

    var someString = 'escape all the quotation marks \"\'';
    

提交回复
热议问题