Since the output is HTML, you need to use
the <br>
tag[
^]:
singid = singid + testids[i] + "<br>";
However, you're using the
text
method to display the error message, which will automatically HTML-encode the output, including the
<br>
tag.
Instead, you'll need to HTML-encode each error message, and then use the
html
method to display the error:
function htmlEncode(value){
return $("<div/>").text(value).html();
}
...
for (var i in testids)
{
singid = singid + htmlEncode(testids[i]) + "<br>";
}
$("#errmsg").html(singid);