Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

html text content new line

//setting this css style solving problem with new line in textContent
h1.setAttribute('style', 'white-space: pre;');

//add 
 in text everywhere You want for line-break (new line)
h1.textContent = "this is line one  
 and this is line 2";
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #html #text #content #line
ADD COMMENT
Topic
Name
3+9 =