So I'm passing the following string structure to populate a jquery datatable cell:

rows[i-1].put('Message', rows[i-1].get('Message') + ' *** ' + noteInner.get('Message'));

Add this gets displayed as:

MessageA *** MessageB

How can I pass a new line or carriage return to make it display as:



in the same cell?

I've already tried '<br\>' and '\r\n' in place of the '***' above but to no avail.


1 Answer 1


One thing you can try, pass some characters from Apex which you are not expecting in the DataTable then replace these characters with <br> inside JavaScript. After that create the DataTable.

var str = "MessageA *** MessageB";
str = str.split("***").join("<br />");
document.getElementById("abc").innerHTML = str;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .