Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么当我有一个带有换行符的变量时 jQuery 不起作用:
这有效:
var text = "This is my text and it works fine";
这不会:
var text = "this is my text and it does not work";
有没有办法解决?我正在尝试创建一个包含数据库文本的变量,它可能包含换行符、标签...
Try Below
var text = "this is my text"; text += " and it does not work";
OR
var text = "this is my text" + " and it does not work";
var text = "this is my text \ and it DOES work now";
以下方式是正确的 -
var text = "this is my text " + "and it DOES work now! ";
检查这个演示