In PHP, can I use JS to input a number to a textarea without overwriting the value in the original textarea?

Source: Internet
Author: User
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 ......
Related Article

Cloud Intelligence Leading the Digital Future

Alibaba Cloud ACtivate Online Conference, Nov. 20th & 21st, 2019 (UTC+08)

Register Now >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.