Hi,
How can I make a new line in a textarea?
I have created these but neither work.
Can someone please help?Code:<textarea name="textarea">test<br>test2</textarea>
<textarea name="textarea">test\ntest2</textarea>
Thanks,
Al
Printable View
Hi,
How can I make a new line in a textarea?
I have created these but neither work.
Can someone please help?Code:<textarea name="textarea">test<br>test2</textarea>
<textarea name="textarea">test\ntest2</textarea>
Thanks,
Al
Code:<textarea name="textarea">test
test2</textarea>
ok,
That works, but I need it to accept values such as <br> or \n to create the newline.
Can the field be made to except html code and proces it?
Thanks,
Al
Not unless you use entities or a sever side script.
I have
But that doesn't work make the line break with the <br>.Code:<textarea name="textarea">test\ntest2<br>test3</textarea>
:(
Al
Textarea is literally that. The values you put in there will be shown. If you 'forget' to end the tag, the rest of your HTML document will be displayed in the textarea.
I'm not too sure why you'd want your users to type in "<br>" or "\n" but if you use a server side script you could make it so anytime they pressed enter (to create a new line) your script would interpret that as "<br>".
Adam
If you're trying to format text that already appears in a textarea then you should probably rethink what you're trying to do with it.
Code:<textarea>foo bar</textarea>