69
rated 0 times
[
70]
[
1]
/ answers: 1 / hits: 18177
/ 7 Years ago, mon, june 12, 2017, 12:00:00
How do I insert a newline character in Javascript? The below code displays everything in one line even when using the newline character n.
<body>
<button onclick=myFunction()>Click me</button>
<div id=demo onclick=myFunction()></div>
<script>
function myFunction() {
document.getElementById(demo).innerHTML = line1nline2nline3nline4nline5nline6;
}
</script>
</body>
More From » html