walkman69
asked on
A way to do an \n or \r\n when writing value in textLine.nodeValue??
Is there a way to do an \n or \r\n or such when writing value in textLine.nodeValue??
Since innerHTML is not recommended to use anymore when dealing with nodeValues.
Thanx.
Since innerHTML is not recommended to use anymore when dealing with nodeValues.
Thanx.
ASKER
Cooooolio:
It sounded like it could work..
But i tried doing it this way:
But it still generates the text \r\n in the <p>-tag..
I also tried putting the <pre></pre> inside of templateDescriptionText, and changed the id to be on the <pre> instead so that the text would be written to it's child (the newTextNode) instead of to the <p>.
Still didn't work.. It looks like the structure you suggested when i look up html-structure in Firefox firebug, have I done anything incorrectly? Would be great if you could post a brief example (javascript).
It sounded like it could work..
But i tried doing it this way:
var templateDescriptionText = document.createElement('p');
templateDescriptionText.setAttribute('class', 'templateDescriptionText');
templateDescriptionText.setAttribute('id', 'templateDescriptionText_1');
var newTextNodeWrapper = document.createElement('pre');
newTextNode = document.createTextNode('');
templateDescriptionText.appendChild(newTextNode);
newTextNodeWrapper.appendChild(templateDescriptionText);
templateDescription.appendChild(newTextNodeWrapper);
But it still generates the text \r\n in the <p>-tag..
I also tried putting the <pre></pre> inside of templateDescriptionText, and changed the id to be on the <pre> instead so that the text would be written to it's child (the newTextNode) instead of to the <p>.
Still didn't work.. It looks like the structure you suggested when i look up html-structure in Firefox firebug, have I done anything incorrectly? Would be great if you could post a brief example (javascript).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Altough not fully optimized for my needs. This solution come closest to the solution I was looking for.
for example
<span id="span_id_xxxx"><pre> \r\n \r\n</pre></span>