当在一个textarea标签中键入一个回车时,实际上会插入2个符号:
在javascript里, line breaks用 表示
when you pull text into Javascript, it treats line breaks as the single " " value.
- In Javascript, new lines are represented by a single " " character.
- Textarea values might have the character combos " " in the text box, but once they are pulled into Javascript, " " becomes JUST " ".
- When replacing out new line characters, treat them as you would any other character. They are not special, they just have special notation.
Ask Ben: Javascript Replace And Multiple Lines / Line Breaks