Today, I read the blue ideal post and talked about a string Line Break Problem. Generally, if HTML code snippets are stored in the Code, the plus sign is used to connect strings.
Of course this will be a little troublesome, so we have the following uncommon method:
Var foo = 'xxx \
Xxx ';
The result of alert (foo) is:
Add a few spaces to indent xxxxxx:
Var foo = 'xxx \
Xxx ';
The result of alert (foo) is:
Xxx
What if I don't fold it?
Var foo = 'xxx \ XXX ';
Alert (foo) returns a syntax error:
SyntaxError: malformed hexadecimal character escape sequence. In fact, this bar is a JavaScript escape character. Using \ + carriage return is equivalent to escaping the carriage return character in the string, so the pop-up is a concatenation string.
Considering that JavaScript code is usually compressed during deployment, it is too dangerous to use \, so use it with caution.
We recommend that you use the following methods to wrap strings:
1. Connect with the plus sign;
2. Data is pushed row by row and finally joined;
3. Use script tags to store HTML clips
Source: mango xiaozhan; Original: Click to View Details