By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,366 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,366 IT Pros & Developers. It's quick & easy.

Problem with innerText/textContent

P: n/a
Hai, I am new to this group. But not to Javascript.
I have a problam with innerText in FireFox.
I have the code as below.
--
var inputArea = document.getElementById("rtsText");
var outputArea = document.getElementById("uniText");
outputArea.innerText = transformInput(inputArea.value);
--
I have two elements, a textarea in which user entered RTS text, and a
div tag in which the converted Unicode text will be place using
transformInput funcion.

But my problem is, innerText is working fine in IE, but not in
FireFox. So i tried to use textContent in FireFox. It is working but
the line breaks (which will get by pressing Enter key) in the input
textare will not reflect in the output div tag. Could anybody tell me
solution.
-Thanks and Regards
-Srinivasa Raju Datla

Feb 13 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
VK
On Feb 13, 10:35 pm, "Srinivasa" <srinivasaraju.da...@gmail.com>
wrote:
the line breaks (which will get by pressing Enter key) in the input
textare will not reflect in the output div tag.
A line break in textarea is CR, NL or CR+NL characters - depending on
OS

A visual line break in HTML is <BRtag == characters "<"+"B"+"R"+">"

Do you see a single match or a correlation between of two? I do not -
because there is not any.

This question was just asked I believe in another thread - look
around. If you want to make a HTML markup with BR tags out of text
source with physical line breaks then use regexp to replace all \n|\r|
\r\n with "<BR>" and use innerHTML - for simple cases - for insertion
over HTML parser invocation.

Feb 13 '07 #2

P: n/a
Srinivasa wrote:
I have two elements, a textarea in which user entered RTS text, and a
div tag in which the converted Unicode text will be place using
transformInput funcion.

But my problem is, innerText is working fine in IE, but not in
FireFox. So i tried to use textContent in FireFox. It is working but
the line breaks (which will get by pressing Enter key) in the input
textare will not reflect in the output div tag.
Use a pre element instead of the div element.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.