为什么当我有一个包含换行符的变量时jQuery不起作用:
这有效:
var text = "This is my text and it works fine";
这不是:
var text = "this is my text
and it does not work";
这有什么办法吗? 我正在尝试创建一个包含数据库中文本的变量,它可能包含换行符,标记...
答案 0 :(得分:1)
尝试下面
var text = "this is my text";
text += " and it does not work";
OR
var text = "this is my text" +
" and it does not work";
OR
var text = "this is my text \
and it DOES work now";
答案 1 :(得分:0)