It’s a CSS problem, not a JavaScript problem. HTML collapses white space by default — this includes ignoring newlines.
Add white-space: pre-wrap
to the output div.
following is the sample code :
{
white-space: pre-wrap
}
solved How to go next paragraph if i filled the form data or numbers..?