Click here to Skip to main content
15,908,254 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
suppose i have some text with html tags - <pre lang="HTML"><b>first text</b>&lt;br/&gt;<strong>2nd text</strong></pre>
placed in a div and it appears as styled but when i copy this html text in a textarea by jquery
all styles not shown in textarea!

plz help asap
Posted
Updated 15-Feb-13 5:52am
v5
Comments
mridul samadder 15-Feb-13 11:57am    
guys "lt;br/&g;" is a line break html code it did not appear in codeproject...so even line break not works in textarea

1 solution

Here is a solution: Show HTML in textarea[^]
The answer in that thread that is relevant:

You can't put HTML content within a text area because it's displayed as-is (e.g. HTML source).
What you can do is to create a div of a fixed size with the overflow set to scrolling, for example:
HTML Code:
XML
<style type="text/css">
div.terms
{
  width: 20em;
  height: 15em;
  overflow: auto;
}
</style>

<div class="terms">
  Terms and conditions<br />
  <br />
  <br />
  Blah blah.. <img src="/whatever.png" alt="blah" />
</div>


 
Share this answer
 
Comments
mridul samadder 15-Feb-13 12:19pm    
i wanted at least new line "<br/>" appear when html codes copied in textarea.i wanted to do all that because i use zclip to copy some styled text(questions and answers) to clipboard so that user can paste it in anywhere(ms word..) as styled else they will not get what is what.so if i can put text in textarea with all style then zclip can copy exactly(actually with line break which is important)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900