Babiker
Babiker

Reputation: 18808

Keeping the format of pasted text in a textarea without visible mark-up info

I had a case where I copied bold text from a web page into a textarea of another page. On paste, the text area kept the text's bold format. When I pasted the same text into a text file I could see no markups or formatting info along with the text. How is the textarea keeping the format of the text?

Thanks in advance.

EDIT:

Upvotes: 2

Views: 2187

Answers (1)

Gert Grenander
Gert Grenander

Reputation: 17104

Textarea is plain text, so are you sure you didn't paste it into a JS driven text editor in the browser? As for pasting it into a text file... well, this is an OS driven event. It will only work if the application allows formatting of the text (e.g. if you paste it into MS Word or OpenOffice.org Writer).

Answering the additional questions:

Again, the textarea is plain text, so there's no formatting or formatting information. The JS driven editor generates the appropriate code depending on what was pasted. This information is passed by the OS' copy&paste functionality. If it's plain text, then there will be no formatting. If the paste contains formatting codes, it will generate the appropriate markup.

Upvotes: 2

Related Questions