js替换换行

这是把Textarea里的换行全部替换为空格的代码.
代码
        $(document).ready(function () {
            $(
"textarea").blur(function () {
                
var o = $(this).text();
                
var p = o.replace(/\r/ig,",").replace(/\n/ig,",");
                $(
this).text(p);
            });
        });
原文地址:https://www.cnblogs.com/yvesliao/p/1779754.html