js替换换行

这是把Textarea里的换行全部替换为空格的代码.
代码
        $(document).ready(function () {
            $(
"textarea").blur(function () {
                
var o = $(this).text();
                
var p = o.replace(/\r/ig,",").replace(/\n/ig,",");
                $(
this).text(p);
            });
        });

 

posted on 2010-07-17 17:49  廖勇军  阅读(467)  评论(0编辑  收藏  举报

导航