Link to home
Start Free TrialLog in
Avatar of RupertA
RupertAFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Preserve carriage returns in a javascript variable

I want to be able to preserve carriage returns in a javascript variable. I have a javascript variable "notes" which if I do

alert(notes);

the alert box shows that the carriage returns in the variable are in place. Good. The problem is that I need to send this variable onto another html page. I do this with this following code (I don't have php on the server so all of this being done with javascript)

window.open("checkalert/checkalert.html?notesinput="+notes,"_newtab");

On checkalert.html, I retreive notesinput into a javascript variable and do an alert. Now I have lost the carriage returns which were in the variable notes on the previous screen.

Could somebody please help me with some javascript code on how to keep the carriage returns for when the data lands on checkalert.html

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Robert Schutt
Robert Schutt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RupertA

ASKER

Perfect. Thanks!