Question

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!

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top