I have a
textarea where the user can write up to 1000 characters. I need to get the
jQuery('#textarea').val() and create an array where each item is a line of the
textarea's value. That means:
This is a nice line inside the textarea.
This is another line.
(let's asume this line is empty - it should be ignored).
Someone left more than 2 new lines above.
var texts = ; text = 'This is a nice line inside the textarea.'; text = 'This is another line.'; text = 'Someone left more than 2 new lines above.';
That way they can be easily imploded for to querystring (this is the qs format required by the provider):
example.com/process.php?q=["This is a nice line inside the textarea.","This is another line.","Someone left more than 2 new lines above."]
I tried both the phpjs
string.split("\n") approaches but they doesn't take care of the extra new lines (aka line breakes). Any ideas?