1

Been searching but not finding a solution.

I've a textarea, asp:textbox, which I try to remove the behavior that text is placed on a second row without the user doing a linebreak. I want it to continue on the same row even thou the textbox itself is not large enough to present all text as long as the user does not press return.

runat="server" Width="387" Height="40px" TextMode="MultiLine" onkeypress="MaxTwohundred(this);" Rows="2" style="overflow-x: scroll; overflow-y:

What is the proper way to accomplish this?

white-space:nowrap Does not do the trick.The user can then not do a simple linebreak by pressing the return button.

Thanks.

Edit

Thanks Tim Medora, it works.

Bellow is what I use.

 TextMode="MultiLine" 
                style="overflow-x: scroll; overflow-y: hidden; " wrap="false"
Johan
  • 753
  • 2
  • 11
  • 31

1 Answers1

1

See this sample: http://jsfiddle.net/nDtpL/4/

While it would be nice to use CSS white-space to control this behavior, browser support is inconsistent (see comments). Instead, I'm using wrap="off" to get the desired behavior (at least in my quick tests on Chrome, IE 9 (and 7 8 emulation mode), and FF).

Here's a similar thread: enter does not work in textarea in Internet Explorer 8

Community
  • 1
  • 1
Tim M.
  • 53,671
  • 14
  • 120
  • 163
  • It actually works for me in Chrome, but in FF I don't get the desired behavior. I'll see if I can find a better solution. What browser are you using? – Tim M. May 04 '12 at 10:06
  • It does not work in internet explorer for me and that is what most users on the company is using and a demand for me.. – Johan May 04 '12 at 10:07
  • Yeah. IE9 ignores the return key, Chrome works correctly, and FF ignores the style altogether. I'm looking to see if there is a proprietary extension for IE to accomplish this. – Tim M. May 04 '12 at 10:08
  • Text keeps expanding until the user hits return on IE 7/8/9 on the PC. Is the JS fiddle not working for you, or is it not working within your actual page? Perhaps there is another problem. – Tim M. May 04 '12 at 10:47