Serializing textarea with wrap=“hard” doesn't give line breaks

被刻印的时光 ゝ 提交于 2020-01-01 07:21:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!