Outputting html code to a <textarea> tag

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-04-09
I was thinking of using a <textarea> tag to do this:


<textarea><b>example sentence blah blah blah</b><br><hr></textarea>

But i found doing this doesn't translate any of the html tags in between the <textarea></textarea>, and just treats them as normal text.  Is there anyway of getting round this or has anyone got any alternate ideas?

Basically it's for an online diary replies section, where replies are read from the database and fed into this textarea.
Question by:bizla
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 7983949
Try using

<textarea><pre>      - Values Here -      </pre></textarea>

values Here would be where all the html you wnat to display in the textbox goes
LVL 17

Accepted Solution

dorward earned 200 total points
ID: 7984549
Textareas are designed to allow users to input data.

It sounds more like you are trying to use it as a scrollable display area.

Try something like:

<div style="width: 25em; height: 5em; border: black 0.5ex inset; overflow: auto">

Your content

LVL 30

Expert Comment

ID: 7984657

Author Comment

ID: 7990589
Cheers Dorward...works like a charm!


Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question