Click to See Complete Forum and Search --> : Replace <br> in textarea


maw_webdesign
02-24-2003, 04:48 AM
Hi there...

I've got a textarea and the value is getting from a cookie.
And in that cookie are some <br> tags.

But when I load the page with the textarea it shows the <br>-tags in my textarea.

Is the a way to convert al the <br> to normal 'enters' ?

Example: when I type in a textarea and press enter, I start on a new line. I'd like to have that in my textarea which is filled with the cookie.

Hope you understand what I mean and that you can help me.

Thnx,

MAW

Charles
02-24-2003, 05:02 AM
<form action="" name="king">
<div>
<textarea name="tut" cols="10" rows="5">
</textarea>
</div>
</form>
<script type="text/javascript">
<!--
document.king.tut.value = 'fee<br>fie<br>foe<br>fum'.replace(/<br>/ig, '\n');
// -->
</script>

This will only work for 88% of users, but then any JavaScript will only work for at most 90% of users. So don't use this, or any other JavaScript, for any thing important.

maw_webdesign
02-24-2003, 06:09 AM
:D