jquery serializeArray values & write results in textarea

1.1k views Asked by At

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!

1

There are 1 answers

3
Flops On BEST ANSWER

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