bloggertech

April 6, 2002
Posting a textarea

Since I've seen a couple of mentions lately of the problems associated with posting a <textarea> in a Blogger post, I thought I'd post my solution: write the <textarea> in javascript.

The problem: when you try to edit a post which contains a <textarea>, and thus also a </textarea>, the <textarea> in the Blogger interface where you edit your post is prematurely closed by the </textarea> in your post, causing you to lose everything after that in your post. Ouch.

The solution: rather than posting the <textarea> directly, write it with javascript:

<script type="text/javascript">
document.write("<" + "textarea rows='25' cols='50'><" + "/textarea>")
</script>
<noscript>Javascript required. Sorry.</noscript>