I was wondering if it's possible to print an array into a textarea and after every 4th row (in array or textarea) place a linebreak or something like -----.
In below example I have some input fioelds inside a form which need to be placed in a textarea. Afterwards this textarea is submitted. 'The reason for this is that I use a SaaS platform so I need to work around this problem.
So what I have is this:
$('.req').on('click', function(){
var data = [];
$('.table input').each(function() {
data.push($(this).val());
});
var textarea = document.getElementById("form-message");
textarea.value = data.join("\n");
});
As a result I get
21546
Some name
150
12345
Some name
555
54646
Some name
578
How can I print it out like this:
21546
Some name
150
----------------
12345
Some name
555
----------------
54646
Some name
578
Is that even possible?
Thx in advance for any assistence :)