If you output HTML and you want newlines to have two options:
Use the <pre> as a wrapper for your text (not suitable here, I think)
<pre>some Text with newlines</pre>
or add <br> instead of \n\r :
some Text<br>with newlines
So in your code this will translate to
goTosList += (element['name'] === undefined ? '' : element['name']) + '<br>';
and then paste this into the DOM on
$('#yourLabel').html( goTosList );
Sirko source share