문제

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