可能重复:
Escape single quotes in jQuery or JavaScript
Escape dynamic strings in JavaScript
如何将字符串(在本例中为HTML代码)分配给JavaScript / jQuery变量?
你如何正确地逃避双引号和单引号?
var html = ""; // <-- HTML goes here
答案 0 :(得分:10)
var html = "<head><title>Hello in \"quotes\"<\/title><\/head>"