Reputation: 4401
I'm trying to offer the user multi-line selectable text using a prompt()
dialog. I will format the text in JavaScript, insert special characters and then throw up the prompt and all the user has to do is hit Ctrl-C, because the text is already selected.
When the prompt is displayed, the selectable text will look like this:
Line1□Line2□Line3□
where the □
is the newline character. It all gets displayed in one line, so it's easily selectable, but pasting it into Notepad or any other text editor should result in this:
Line1
Line2
Line3
I tried \r
and \n
and even \r\n
, but it seems to truncate it to the first line.
How can I do this?
Upvotes: 0
Views: 613
Reputation: 13560
You can use Ctrl + C (at least on windows) to copy the content of a dialog box (like alert()
in JavaScript).
Upvotes: 1