0

Possible Duplicate:
JavaScript string newline character?

I am aware that \n is the newline character but it does not work for IE. I have to use \r to get it to work for IE. Is there a javascript or JQuery function to insert a newline no matter the browser type?

Community
  • 1
  • 1
Luke101
  • 63,072
  • 85
  • 231
  • 359

2 Answers2

1

If you are in an HTML element $("#myelement").append('<br />');

If you are in a textarea $("#mytextarea").append('\n');

It's a very obvious answer, tell you if it works or not.

Julien Lafont
  • 7,869
  • 2
  • 32
  • 52
  • I have tried \n in explorer but it does not work. I have to use \r to force it to go to the next line – Luke101 Aug 14 '11 at 19:34
1

Try using \r\n which is the windows newline. It should work in Linux and Unix as well though.

Alex
  • 1,327
  • 2
  • 11
  • 20