Reputation: 739
here i'm copying the contents from webpage and pasting the contents in form fields like textarea. while retrieving the form contents, escape characters are also coming along which is breaking the functionality. how to avoid the escape characters and retrieve only the given text. The escape characters are not visible in the form fields, but its visible in json.
the above 1st image is entered text and second image is retrived in json. Help me out in this Thanks.
Upvotes: 2
Views: 796
Reputation: 1256
Try to remove the line breaks with this line of code:
text = text.replace(/(\n|\r)/gm,"");
Cf: How to remove all line breaks from a string?
Upvotes: 1