heldplayer Posted October 20, 2009 Share Posted October 20, 2009 is there a way to insert linebreaks in a textarea with just HTML and javascript? Link to comment Share on other sites More sharing options...
jeffman Posted October 20, 2009 Share Posted October 20, 2009 Use the "\n" character.In a textarea, "hello\nworld" renders as:helloworldTip: this is also true of alert messages. Link to comment Share on other sites More sharing options...
heldplayer Posted October 20, 2009 Author Share Posted October 20, 2009 it doesn't do anything exept if you write <textarea>hello \n world</textarea> it gives hello \n world else it displays hello world if you script it, nothello world Link to comment Share on other sites More sharing options...
justsomeguy Posted October 20, 2009 Share Posted October 20, 2009 You use \n as an escape sequence in Javascript to create a newline. If you're just typing text into a text area, if you want a linebreak you use the enter key. Link to comment Share on other sites More sharing options...
heldplayer Posted October 20, 2009 Author Share Posted October 20, 2009 did you tested it?it doesn't work for me, but I've been thinking, can't you use the entity name of enter to insert it, like < and >what is the entity name of enter cause i can't find it in the reference Link to comment Share on other sites More sharing options...
justsomeguy Posted October 20, 2009 Share Posted October 20, 2009 There's not an entity for a linebreak. I haven't tested, sorry. See if a regular <br> shows up as a line break in a textarea or if it shows <br>. Link to comment Share on other sites More sharing options...
heldplayer Posted October 20, 2009 Author Share Posted October 20, 2009 <br> breaks my code<br> just shows <br>edit: ff displays \n as it should be, ie does not Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.