简体   繁体   English

通过javascript保留textarea换行符

[英]Preserve textarea line breaks via javascript

I'm looking for a piece of script that will convert a user's textarea line breaks into html on a form submission output so that formatting is preserved in our notification emails. 我正在寻找一个脚本,它将在表单提交输出上将用户的textarea换行符转换为html,以便将格式保留在我们的通知电子邮件中。

At the moment I have a couple of fields that require reasonably detailed answers and after submission these come through as one big chunk of text with no line breaks. 目前,我有几个字段需要相当详细的答案,提交后这些字段将作为一大段文本出现,没有换行符。

Any help would be much appreciated, 任何帮助将非常感激,

Oli 奥利

Managed to get to the bottom of this. 设法深入到此。 Our CMS had a shortcode modifier to convert new lines into line breaks. 我们的CMS具有shortcode修饰符,可将新行转换为换行符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM