How to get setValue() to display new lines in textarea and not \n?

How do I get a codemirror textarea to show new lines and not the literal string returned by setValue()?

I am using getValue() to save html from a codemirror textarea in localstorage. When I retrieve the localstorage using setValue() the textarea it will display “new \nline”. How do I display;

new
line

Thanks,

Chris

Make sure the string you pass to setValue actually has newlines in them, and not a backlash followed by an N character.

1 Like

Thanks Marijn,

I just realised the route of my problem was not what I thought. localstorage automatically double quotes what you save as a string. This what was really tripping me up.

Chris