简体   繁体   中英

Append new line when transfer textbox to textarea (JQuery)

i have function that will create multiple id of textbox. My problem now is how can i append this textbox value to textarea with new line.

Currently my code is like this :

 var i=$('table tr').length; (function(index){ $('#transfer').on('click', function() { var tilam_item = $('#tilam_item'+index).val(); $('#text').append(tilam_item); }); })(i); 

I've successful in append all the item in the textbox but they are not in proper alignment. I want to add new line when append the value but i cannot figure it how.

Add new line char '\\n'.

 var i=$('table tr').length; (function(index){ $('#transfer').on('click', function() { var tilam_item = $('#tilam_item'+index).val() + '\\n'; $('#text').append(tilam_item); }); })(i); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM