0

I am writing a Firefox extension. When a user highlights and right clicks a selected text on a webpage, the extension captures the text and displays it in a textbox (xul window). The textbox shows the correct formating (like the line breaks, spaces, * for li tags.). But the problem happens when i try to store the textbox value in a variable. The line breaks are gone.

var selText = document.getElementById("txtboxSelectedText").value; //

Can anybody help?

Thanks a lot.

Cheekysoft
  • 35,194
  • 20
  • 73
  • 86
Murali Bala
  • 43
  • 1
  • 6
  • how are you determining the line breaks are gone? are you sure the line beraks are being lost at that point and not later? – Jonathan Fingland Jun 25 '09 at 14:22
  • after i fetch var selText = document.getElementById("txtboxSelectedText").value; // i do an alert(selText). – Murali Bala Jun 25 '09 at 15:34
  • It would be much easier to help you if you posted the minimum code we can use to see the problem. Your problem is obviously not in the line of code you posted and it's really hard to guess where you could have done something wrong or triggered an (unknown) bug. – Nickolay Jul 09 '09 at 14:52

1 Answers1

0

Is this a real textbox or a rich text editor like tinyMCE or open wysiwyg? In a real textbox there are linebreaks. In the rich text editors, they are really iframes with html content... what looks like a line break is really a <br/> tag.

The reason I suspect this is you can't have li tags (and their associated bullet points) inside a normal textbox

Jonathan Fingland
  • 56,385
  • 11
  • 85
  • 79