开发者

How to remove the "automatic new line" on textarea [duplicate]

开发者 https://www.devze.com 2023-03-24 21:04 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: how remove wordwrap from textarea
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

how remove wordwrap from textarea

I have a text area :

<textarea id="areaTL" style='width:700px; height:400px;></textarea>

and I'd like to do a n开发者_运维问答ewline only when there is a \n into the text, so the horizontal scroll should be larger than the max text inside the textarea.

Tried with :

overflow: scroll; wrap="off"'

but seems it doesnt works. I'd like to do it for Chome/Firefox and IE7+.

How can I do it?

EDIT

Using white-space:nowrap; as suggested I get this working, but if I do :

textArea=$('#areaTL').val().split('\n');

I get only 1 element in the array, not N. Why?


I believe white-space:nowrap; is what you're looking for instead of wrap.


try this it should work

<textarea cols=100 rows=5 wrap='off'>
0

精彩评论

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