I have a textarea that I am trying to fill with a list of words which have been fetched by a php script through AJAX, but when the list is diplayed in the textarea, the linebreaks are converted to (what appear to be) spaces (causing all the words to be on one line).
In the php I have tried:
echo implode("
",$list); // and
echo implode("
",$list);
and none of these pass workable linebreaks to the javascript. I have searched this site (and others), and the general solution seems to be to replace any occurance of
with
. I tried that using javascript, more or less like so:
textarea.innerHTML = ajax_response.replace('/
/g','
');
however, this doesn't solve the problem. Is there something I'm missing? As I say, most solutions I've found online suggest to try the replacement, but is there any other workarounds for IE?
Thanks :)