2

I have created a webpage to create a post. For taking description, I have used CKEDITOR. When I save data in mongo database it is saved as:

'<p>How are you?</p>\r\n'

But when I fetch this and display it in my ejs file, then I got an error that is:

Uncaught SyntaxError: Invalid or unexpected token

After fetching the content looks like this:

"&lt;p&gt;How are you?&lt;/p&gt;"

Can you help me out in this? Thanks in advance. And also ask me if you need further explanation.

0

1 Answer 1

1

You can decode HTML content by using decodeURIComponent. for more details (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent)

  const uri = "&lt;p&gt;How are you?&lt;/p&gt";
  const decodeUri = decodeURIComponent(uri);
  console.log(decodeUri)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.