Click to See Complete Forum and Search --> : Textarea Line Breaks?


greenpizza13
11-19-2003, 06:55 PM
How would I place a line break, like the effect of <br> in a textarea box?
Please, anyone...

fredmv
11-19-2003, 06:57 PM
You use a newline character (\n).<script type="text/javascript">
function changeValue(foo)
{
document.forms[0].elements['foo'].value += foo + '\n';
}
</script>
<form action="#">
<textarea name="foo" rows="10" cols="50"></textarea>
<hr />
<a href="#" onclick="changeValue('bar');">Hello, World.</a>
</form>I hope that helps you out.

greenpizza13
11-19-2003, 07:51 PM
Thanks a lot /n /n, I wont forget!

fredmv
11-19-2003, 07:54 PM
Originally posted by greenpizza13
Thanks a lot /n /n, I wont forget! No problem. But, it's \n, not /n. ;)