I’m wondering why javascript/jquery removes my linebreaks (\n) when I copy a textarea’s value (id=”t”) to another element (id=”t_hidden”).
$('#t_hidden').val($('#t').val());
When I do sth. with value of $(‘#t_hidden’) I recognize that my linebreaks have disappeared.
Does anybody know why?
Is the destination element a textarea? If not, the linebreaks could be copied, but ignored as whitespace. You’d need to replace them with a
<br />to have them work.