+ 4
A little quick help please! How to give a line in JS when I'm printing some text from an array of text on the screen?
13 Respuestas
+ 4
txt.innerHTML +="<br> ";
Try this line to see how a non-breakable space works.
+ 6
@Shashi Ranjan use Tab for setting spaces
+ 6
Ah, you meant HTML but I JS
+ 5
use \n at the end to start printing in next line
+ 5
What are you asking exactly ??
Please elaborate.
+ 4
Seeing an example of your code would most likely help, but usually if you pass in a break tag (<br>)in your string it will insert a newline for what is displayed in the browser. A '\n' will usually just effect the text in the source html (right click - show source in the browser)
+ 3
You have a few options depending on what you want. You can use a non-breakable space
https://www.w3schools.com/html/html_entities.asp
or one of the variations of the pre tag
https://www.w3schools.com/tags/tag_pre.asp
+ 3
Great! It worked! Thank you gentlemen!😁
+ 3
Use +'\n'+
It 100% working with Javascript.
Have a nice day.
Follow me for more update and answers
+ 2
Actually, I'm printing text automatically..
it's a typing animation using js and in that I want to print some text in the new line.
+ 1
Great! It worked! And do you have any idea about how to give more spaces in a line to make it more look like a paragraph?
+ 1
tab ok...but what exactly to write there?
+ 1
Thanks for the links but it couldn't help me.
See this one, I'm just creating and I want new line to start like a paragraph.
https://code.sololearn.com/W3mUUcwIh7Lv/?ref=app