I am looping trough a table with jquery, and trying to get the text from TD's. Once I have the TD values, I'm concatenating them into a single text:
table.find('tr').each(function (i) {
var $tds = $(this).find('td'),
order_num = $tds.eq(1).text(),
row_id = $tds.eq(2).text(),
accnt_id = $tds.eq(3).text(),
status_cd = $tds.eq(4).text(),
sub_status = $tds.eq(5).text();
row = row+"\n"+order_num+" "+row_id+" "+accnt_id+""+status_cd+" "+sub_status;
});
$("#dialog").text(row);
$("#dialog").dialog("open");
copyToClipboard(row);
The problem is, that I am not able to add new line to the end of each tr line. I've tried the following but non of them was successful:
row = row+"\n"+order_num+" "+row_id+" "+accnt_id+" "+status_cd+" "+sub_status;
row = row+"\u000A"+order_num+" "+row_id+" "+accnt_id+" "+status_cd+" "+sub_status;
When I add the text to the dialogue or to clipboard, the new line is missing, and all I have is a text snake. Dou you have any idea how to properly add a new line to the text in JQuery? Thanks
<br/>$("#dialog").text(row);you should add<br><pre>...</pre>block (in your example<pre id="dialog">...</pre>)brusehtml()instead oftext()