textarea中的空格与换行
2014-12-10 16:41
204 查看
当在一个textarea标签中键入一个回车时,实际上会插入2个符号:\n\r 在javascript里, line breaks用\n表示 when you pull text into Javascript, it treats line breaks as the single "\n" value.
In Javascript, new lines are represented by a single "\n" character.
Textarea values might have the character combos "\n\r" in the text box, but once they are pulled into Javascript, "\n\r" becomes JUST "\n".
When replacing out new line characters, treat them as you would any other character. They are not special, they just have special notation.
Ask Ben: Javascript Replace And Multiple Lines / Line Breaks
相关文章推荐
- textarea关于空格和换行那点事
- 从textarea中空格、逗号、换行转换为逗号分隔的字符串 js string.split
- jsp实现textarea中的文字保存换行空格存到数据库的方法
- jsp的textarea标签把换行和空格保存到数据库
- textarea换行与空格相关操作
- 表单对象textarea内容的格式控制(回车、换行、空格)
- <textarea>中嵌套其他标签输出出现不必要的空格和换行问题
- textarea 存入数据库后 换行 、空格显示
- 完美输出textarea样式(换行,空格)
- textarea保留换行和空格
- 保存textarea输入的空格和换行格式
- 解决jsp中textarea 输入显示的问题( 包括回车、换行、空格 )
- Java-js处理textarea自动生成的制表符(空格,换行,tab等)
- jsp实现textarea中的文字保存换行空格存到数据库
- textarea替换换行和空格的方法
- 网页中textarea中有好多空格和换行的解决方法
- 获取textarea中的换行和空格并转义显示在网页上
- textarea 回车换行空格等字符存入数据库并读取
- 关于textarea中换行、回车、空格的识别与处理
- jquery实现textarea输入内容换行和空格提交后有效果