Is there a way to embed a textarea block inside of another textarea block but not render the inside textarea and preserve the outside textarea? I cannot modify the inside textarea. Perhaps there is something better to use for the outside block than a textarea. I need something that will submit its contents at POST. Converting the inside angle brackets to entities is not an option since I want to preserve the html inside the outer textarea.
Non-working Sample Code:
<!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
<textarea>Inside Textarea</textarea>
</textarea>
<input type="submit" value="Submit" />
</form>
</body>
</html>
I am pretty sure the answer is no -- cannot do it with a textarea. From the MDN docs: The HTML <textarea> element represents a multi-line plain-text editing control.
No, it is not possible(it will not render the UI). If you want to show form fields why are you using textarea ? You can just use normal html. Save this answer.
You shouldn't try to place a button inside a textarea, that's doesn't make sense semantically and shouldn't be done. You could do what you're currently doing: positioning the button on top of the textarea in the right place.
Yes you can use textarea tags outside of a form and they will display and allow text to be inserted and edited, but not being tied to a form their uses will likely be limited.
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
<textarea>Inside Textarea</textarea>
</textarea>
<input type="submit" value="Submit" />
</form>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With