need different solution, <pre> tags and innerhtml

L

lhjayunaz

<div id=why>thank you</div>

<script>
var convertnow = "hello hello";
document.getElementById("why").innerHTML = "<PRE>" + convertnow + "</
PRE>"
</script>

Other than wrapping PRE tags, how can I preserve the whitespacing in
this innerHTML construction?
 
R

Richard Maher

Other than wrapping PRE tags, how can I preserve the whitespacing in
this innerHTML construction?

Would it be possible to change WHY's style to: -

style="white-space: pre;"

Regards Richard Maher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top