views:

19

answers:

1

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 mark ups or formatting info along with the text. How is the textarea keeping the format of the text?

Thanks in advance.

EDIT:

  • How is the textarea or JS driven text editor formatting the pasted text without any formatting info being passed along with the pasted text?

  • If formatting info is bieng passed internally by the browser, how is the webpage receving that info?

+1  A: 

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.

Gert G