jquery文本域换行替换为br

var strContent = document.getElementById("text").value;
strContent = strContent.replace(/\r\n/g, '<br>'); //IE9FFchrome
strContent = strContent.replace(/\n/g, '<br>'); //IE7-8
strContent = strContent.replace(/\s/g, ' ');

然后在提交

最后修改:2019-11-17 20:39:01
0