If I've got a textarea like this:
<textarea id="foo" cols=80 wrap="hard"></textarea>
Is there any way, using JavaScript, to grab the hard-wrapped text?
I've tried the obvious $("#foo").val()
, but that returns the unwrapped text.
For example, if the textarea is:
<textarea id="bar" cols=5 wrap="hard">a b c d e f</textarea>
The browser will wrap the text to:
a b c
d e f
And I was some way to grab that text – "a b c\nd e f"
(which, because of wrap=hard
, is the text that would be sent if the <textarea…
was submitted in a <form…
).