Why \n is appending to the value after JSON.stringify. Here is the example link
var formData = new Array();
if ($(this).get(0).tagName.toUpperCase() === 'DIV' ){
content = $(this).html();
}
alert(JSON.stringify(formData));
Note: Content in the Div is dynamic and I don't have any control on what is displaying there. I should use .html() to get the data in Div
<div>
the text and the closing</div>
you see you added new line right that why it's adding \n to indicate that new line in the text format – andrex Sep 23 '14 at 5:50\n
in<div>
html. – Regent Sep 23 '14 at 5:50<div contenteditable="true" placeholder="" name="content[0]" id="pres_preview_58c57bd0044aa58704f13133b381e97a_0" class="pdfElement tempContent txtfield">Empire City Casino at Yonkers Raceway</div>
which has no spaces then there is not \n being added. It's because the string being retrieve has newlines but HTML doesn't interpret new lines so you can't see it in the browser. – andrex Sep 23 '14 at 5:51