I cant do new line from javascript, I tried to do that with n, but nothing.
JavaScript
x
1
1
document.getElementById("text").textContent = "hhh" + 'n' + "df";
JavaScript
1
3
1
<h1 id="text">
2
abc
3
</h1>
Advertisement
Answer
Apparently you are pretty new in javascript. You should use <br>
instead. n
new line for console outputs. Also you should use innerHTML
instead of textContent
.
JavaScript
1
1
1
document.getElementById("text").innerHTML = "hhh" + '<br>' + "df";
JavaScript
1
3
1
<h1 id="text">
2
abc
3
</h1>
With textContent
JavaScript
1
1
1
document.getElementById("text").textContent = "hhh" + '<br>' + "df";
JavaScript
1
3
1
<h1 id="text">
2
abc
3
</h1>
Console example:
JavaScript
1
1
1
console.log("abcndef");