In PHP, can I use JS to input a number to a textarea, but it does not overwrite the value in the original textarea. I want to create a page for example. after entering a value in the text box below, click "add" to display the value in textarea. Then, enter the value in the text box and click "add". The second value is also displayed in textarea, with a line break between the two, the younger brother uses arrays to input a number to a textarea using JS, but does not overwrite the value in the original textarea.
I want to create a page, for example, enter a value in the text box below, click Add to display the value in textarea, and then click add in the text box, the second value will also be displayed in textarea. line breaks can be generated between the two. The younger brother uses an array. The problem is that I assign the entire array to textarea every time, is there a way to output data to textarea one by one? a line break is required between each value.
Var arr1 = new Array ();
Function arr ()
{
Arr1.push (document. getElementById ('B'). value );
Document. getElementById ('A'). value = arr1.toString ();
}
Script
Reference
------ Solution --------------------
Document. getElementById ('A'). value + = "\ n" + document. getElementById ('B'). value
------ Solution --------------------
Reference:
Reference: document. getElementById ('A'). value + = "\ n" + document. getElementById ('B'). value
Thank you for your advice. The problem has been solved.
It's late. lz is so fast. congratulations.
------ Solution --------------------
Don't forget to paste it to the moderator.
------ Solution --------------------
Points for seeing ......