The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

prevent horiz. scroll in textarea: soft wrap very long words?

Hi all,

I'm doing a little personal project for fun, and it'd be great to know how to get a very long word to wrap inside a textarea. I mean, imagine typing a long string of random digits, say, without spaces in-between. What I want is for the string to go to a newline inside the textbox even though there isn't a space. I want this change to be 'virtual' or 'soft' so that the actual string itself still doesn't have spaces. My browser currently adds a horizontal scrollbar instead of breaking the line.

Obviously, this is counter to what most people want, so I'm prepared to accept that there may not be a way to do it. But still I'd like to try if anyone can help me out!

There is no standards-compliant way to do it. The specs only allow lines to be wrapped at whitespace characters (space, tab, carriage return, line feed). IE and Opera incorrectly wrap at some other characters as well (hyphens, brackets, etc.) but that violates the specs.

There are proprietary HTML attributes and CSS properties that can achieve what you're looking for, but only in one or two browsers.

There is no standards-compliant way to do it. The specs only allow lines to be wrapped at whitespace characters (space, tab, carriage return, line feed). IE and Opera incorrectly wrap at some other characters as well (hyphens, brackets, etc.) but that violates the specs.

There are proprietary HTML attributes and CSS properties that can achieve what you're looking for, but only in one or two browsers.

Ah well -- a minor drawback. I'd much rather be standards-compliant. I can think of a few ways to cut the Gordian knot, as it were, but I'll just work on getting my proof of concept up and running.