Jquery 在这种情况下,如何使javascript变量删除新行?

Jquery 在这种情况下,如何使javascript变量删除新行?,jquery,Jquery,当我在外传课文时,它就像 Orange juice fresh wth topping and crustig provided,and it will be an extracost,. juice available for sugar free person also 如何使文本成为一行删除所有新行 这是我的小提琴 您可以使用替换方法: str = str.replace(/(?:\r\n|\r|\n)/g, '<br />'); 请修理那把小提琴。

当我在外传课文时,它就像

Orange juice fresh wth topping and crustig provided,and it will be an extracost,.
            juice available for sugar free person also
如何使文本成为一行删除所有新行

这是我的小提琴


您可以使用替换方法:

str = str.replace(/(?:\r\n|\r|\n)/g, '<br />');

请修理那把小提琴。这是一场灾难,而且控制台不会返回任何东西。
str = str.replace(/(?:\r\n|\r|\n)/g, ' ');