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?
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.
Try using \r\n
which is the windows newline. It should work in Linux and Unix as well though.
精彩评论