How can I embed a textarea inside of another textarea in HTML?

I've have adequate success wrapping the textarea in a paragraph tag. These one worked for me:

<p style="margin:0;"><textarea rows="1" readonly="readonly" id="summary" name="Summary" ></textarea></p>

<p><textarea name="Note"></textarea></p>

This one didn't work for me:

<p><textarea rows="4" name="In_Honor_Address" class="blockInput"></textarea></p>

Haven't figured out what the difference is between one of these working and the other not, but worth a try.


Yo dawg.

Seriously, encoding the html is the only option. You can always decode it/do whatever in your server-side code once it gets posted.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>Test Embedded textareas</title>
</head>
<body>
    <form method="POST">
        <textarea>
            Outside Textarea
            &lt;textarea&gt;Inside Textarea&lt;/textarea&gt;
        </textarea>
        <input type="submit" value="Submit" />
    </form>
</body>
</html>

No. You can't do it. The only thing valid inside of a textarea is text. It's a textarea. :-)

Tags:

Html