How to wrap text without regard to space and hyphen

Viewed 3877

I have a contenteditable div where the user can input text. I want the text to wrap automatically, but not like the default at spaces or hyphens, but instead like this:

This is some t
ext that conta
ins hyphenated
 words like th
is-thing-here,
 and also spac
es.

How can I achieve this?

3 Answers

You could try it with <pre> if it is known beforehand. If it is not the usage of JavaScript is good. You could getElementById and format it to your liking.

Related