how to decode <div> innerHTML to <textarea>
Posted
by
user475464
on Stack Overflow
See other posts from Stack Overflow
or by user475464
Published on 2012-10-27T22:42:10Z
Indexed on
2012/10/27
23:00 UTC
Read the original article
Hit count: 162
JavaScript
|html
below is the <div>
and <textarea>
in my webpage
<div id="div_1" onclick="document.getElementById("textarea_1").innerHTML=document.getElementById("div_1").innerHTML;">
paragraph 1
paragraph 2
paragraph 3
paragraph 4
</div>
<textarea id="textarea_1"></textarea>
when i click the div i need to show <div>
innerHTML to <textarea>
but its coming like below
<textarea id="textarea_1">paragraph 1<br><br>paragraph 2<br><br>paragraph 3<br><br>paragraph 4</textarea>
i need output like this (correct format of <div>
)
<textarea id="textarea_1">
paragraph 1
paragraph 2
paragraph 3
paragraph 4
</textarea>
© Stack Overflow or respective owner