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

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top