What is the character code for enter? [closed]

It’s a bit platform-specific. It’ll usually be \n or \r\n.

Of course, if you’re talking about HTML, none of those will make a difference because in HTML (unless you’re dealing with pre formatting, either the pre element or anything with the various pre-like values for white-space in their styles), whitespace is just a space. You’d need to use an element to break things up vertically (<br>, or something more appropriate to what you’re doing).

Looking at your fiddle, you’re dealing with HTML, so \n, \r\n, etc. are irrelevant. Here’s an updated one doing this:

$("#test").append("<br>And hello from script");

Fiddle

…but <br> is usually a last resort. There’s usually something more semantically-appropriate you can do.

Leave a Comment