+ 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?

17th Mar 2018, 5:38 PM
Шащи Ранжан
Шащи Ранжан - avatar
13 Answers
+ 4
txt.innerHTML +="<br>&nbsp;&nbsp;"; Try this line to see how a non-breakable space works.
17th Mar 2018, 7:42 PM
ChaoticDawg
ChaoticDawg - avatar
+ 6
@Shashi Ranjan use Tab for setting spaces
17th Mar 2018, 7:31 PM
Bohdan Sakovych
Bohdan Sakovych - avatar
+ 6
Ah, you meant HTML but I JS
17th Mar 2018, 7:42 PM
Bohdan Sakovych
Bohdan Sakovych - avatar
+ 5
use \n at the end to start printing in next line
17th Mar 2018, 6:03 PM
kaliki chandu
kaliki chandu - avatar
+ 5
What are you asking exactly ?? Please elaborate.
17th Mar 2018, 6:04 PM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
+ 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)
17th Mar 2018, 7:26 PM
ChaoticDawg
ChaoticDawg - avatar
+ 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
17th Mar 2018, 7:33 PM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Great! It worked! Thank you gentlemen!😁
17th Mar 2018, 7:52 PM
Шащи Ранжан
Шащи Ранжан - avatar
+ 3
Use +'\n'+ It 100% working with Javascript. Have a nice day. Follow me for more update and answers
19th Mar 2018, 9:35 PM
Nwadike Kenneth
Nwadike Kenneth - avatar
+ 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.
17th Mar 2018, 6:06 PM
Шащи Ранжан
Шащи Ранжан - avatar
+ 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?
17th Mar 2018, 7:29 PM
Шащи Ранжан
Шащи Ранжан - avatar
+ 1
tab ok...but what exactly to write there?
17th Mar 2018, 7:32 PM
Шащи Ранжан
Шащи Ранжан - avatar
+ 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
17th Mar 2018, 7:37 PM
Шащи Ранжан
Шащи Ранжан - avatar