I’m having a peculiar issue. I’m reading the HTML from a div contenteditable, and then sending an AJAX request to my backend that saves that HTML to a mongodb document, and I also save that exact same HTML to localStorage.
And, guess what happens? When the text is loaded back later, the localStorage renders fine, but, the data retrieved from the database turns into text with  ’s and <div>s scattered throughout. Does MongoDB do something to the data before saving it?
Sounds like the text returned from the server is HTML encoded. Whether the value in MongoDB is encoded or the result is encoded just before sending the response is something you can tell by looking at actual records in MongoDB.
One easy way to work with the encoded data is:
Without jQuery and logic behind this way (coded on the fly):