javascript - JSON.stringify adding \n to the array -


why \n appending value after json.stringify. here example link

http://jsfiddle.net/7nketlmy/

 var formdata = new array();  if ($(this).get(0).tagname.touppercase() === 'div' ){         content = $(this).html();     }   alert(json.stringify(formdata)); 

note: content in div dynamic , don't have control on displaying there. should use .html() data in div

you added new line in div. that's why /n appearing

<div contenteditable="true" placeholder=""  name="content[0]" id="pres_preview_58c57bd0044aa58704f13133b381e97a_0" class="pdfelement tempcontent txtfield">empire city casino @ yonkers raceway</div> 

use this.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -