html textarea注入换行符 [英] html textarea injecting line breaks
问题描述
我有一个奇怪的问题。
I've got a weird problem.
我有一个html textarea,cols设置为84,如下:
I have an html textarea, with the cols set to 84, like so:
<textarea id="caseNote_note0" class="txtArea" name="caseNote_note" style="line-height: 1.1em; height: 5em;" wrap="hard" rows="10" cols="84" tabindex="7">blah blah blah</textarea>
txtArea
类定义为: / p>
The txtArea
class is defined as:
.txtArea {
font-family:arial,sans-serif;
font-size:1.0em;
width:99%;
rows:10;
overflow:hidden;
border:none;
font-family:arial,sans-serif;
margin: 0px 3px 0px 3px;
}
textarea几乎覆盖整个屏幕。
The textarea is stretched across almost the whole screen.
当用户键入数据时,所有数据都会按照预期显示在textarea中。
When the user types in data, the data all appears in the textarea as you would expect.
但是,
before保存:
------------------------- -------------------------------------------------- ----
blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah
---------------- -------------------------------------------------- -------------
:
-------------------------------------------------- -----------------------------
blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
blah blah blah blah blah
----------------------------- --------------------------------------------------
-------------------------------------------------------------------------------
如果我将 cols
更改为大于84(例如150),则会显示换行符(即
If I change the cols
to be greater than 84 (say 150), the linebreaks appear later (i.e. more text shows before a line break seems to get enetered).
文本也被保存在数据库表中,其中包含这些明显的神秘换行符。
The text is also being saved in the database table with these apparent mystery line breaks.
一个替代方法是将 cols
设置为真正高(如500),那么我想我不会遇到这个问题....
A wordaround is to set the cols
to something really high (like 500), then I guess I wouldn't run into this problem....but I'd rather know why this is happening in the first place.
任何帮助都非常感谢!
干杯
Jarrett
推荐答案
删除 wrap
属性。不需要。
这篇关于html textarea注入换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!