var popupWindow = window.open('','null','location=no,toolbar=no,menubar=0,scrollbars=0');
var previewMsg =
'ID: ' + data.template.MsgID + '\n' +
'Message Body: ' + data.template.MsgContents + '\n';
popupWindow.document.write(previewMsg);
I am trying to add a line break as you can see by the '\n'. I've tried '\n\n', '\r'. Does not seem to stick when the pop up opens.
HTML does not normally use
\r
nor\n
to represent line breaks. Try wrapping each section in a block-level element such as a<div>
or<p>
, or using the<br/>
tag, which is the closest thing you'll get to a line break in HTML, though it's not terribly semantic.Alternately, use CSS: