开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜