开发者

textarea in IE7 : can't make a carriage return

开发者 https://www.devze.com 2023-03-19 21:05 出处:网络
i\'m using a textarea in a webpage which is loaded through an Ajax request. The result of the request is a list of numbers separated by \\n

i'm using a textarea in a webpage which is loaded through an Ajax request. The result of the request is a list of numbers separated by \n

Here is the result :

<textarea wrap="hard" rows="10" cols="80">111000333
414141411
</textarea>

In Chrome it works correctly but in IE7 the carriag开发者_开发问答e return doesn't work and all the result is on the same line.

What can i do ? use another way of making carriage return or add properties to the textarea ?

Thanks


could you use javascript regex? i.e. str.replace(/\r\n/gi, "
")

where str is the innerHTML of the textarea

0

精彩评论

暂无评论...
验证码 换一张
取 消