问题
I have a textarea with "hard" wrapping:
<textarea name="text" cols=5 wrap="hard">a b c d e f</textarea>
When I serialize this textarea with jquery I get:
text="a+b+c+d+e+f"
Here is a fiddle. The problem is that I want to get the line breaks from the textarea.
If I actually submit the form, then on the server I see the form come in with the proper line breaks. But I'd like to be able to get the line breaks without having to reload the page. I've already tried using the jquery form plugin with no luck. And I've tried having my form target an iframe, but that comes with its own problems.
Is it possible to get the line breaks from a textarea without reloading the page?
来源:https://stackoverflow.com/questions/10574365/serializing-textarea-with-wrap-hard-doesnt-give-line-breaks