I'm having a little issue which I can't seem to get my head around. I am attempting to use jQuery's .serialiseArray function to combine a number of inputs & textarea values into single textarea for when the form is submitted.

I have created the following JS Fiddle to highlight my current code: http://jsfiddle.net/4XjhB/2/

As you will see, I have been able to combine the values into the array, but I cannot seem to have the array write each value on a new line in the textarea. It only writes the last input.

I have also included a div to show that it is working outside of a textarea

Please let me know where I am going wrong!

有帮助吗?

解决方案

You should collect all values, when you call .val() it replaces value of textarea, but not appending it; http://jsfiddle.net/4XjhB/3/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top