在IE8 Newline问题中的Textarea [英] Textarea in IE8 Newline issue

查看:132
本文介绍了在IE8 Newline问题中的Textarea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个跨浏览器的表单,这需要一个textarea。此textarea通过两种方式接收数据:
- 向服务器发送Ajax调用并返回数据
- 用户输入数据

I'm making a cross-browser form, which requires a textarea. This textarea receives data by two ways: - Sending an Ajax call to the server and returning data - User inputted data

http://jsfiddle.net/garrettwong/x3KSP/

我在IE8上遇到问题,其中textarea文本未格式化(换行未被读取),而在Chrome中,相同的代码,很好地格式化textarea。我希望尽可能使用单独的JavaScript解决方案,但我不确定从哪里开始。

I'm having an issue on IE8 where the textarea text is not formatted (newlines not being read), where as in Chrome, the same code, nicely formats the textarea. I'm hoping to use a solely JavaScript solution if possible, but I'm not sure where to go from here.

推荐答案

你为什么用 text()?使用 val() 设置值。

Why are you using text()? Set the value using val().

新行通常是 \ n\\\

这篇关于在IE8 Newline问题中的Textarea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆