(Excuse me, I don’t know how to finalize the discussion…)
I’m really a beginner (and old ha ha ha)
I found some programming that allows me to display random sentences from HTML. The code is fine after some reflections and adaptations I am trying to make a line BREAK in a variable so that the name of the creator of the quote is after the sentence, below.
For example and simplified, a sentence:
“So shaken as we are, so wan with care,” Henry announces to his court. Shakespeare"
I would like this:
“So shaken as we are, so wan with care, Henry announces to his court.” (on line return…)
“Shakespeare”
I can’t find…
The code used (which I did not create comes from a codePen site. The script.js gives this and works (in short) but not possible to find a line break
var quotes = ["So shaken as we are, so wan with care," Henry announces to his court. Shakespeare",
"To be, or not to be: that is the question. Shakespeare"
]; etc. etc.
function getQuote() {
var randomQuote = quotes[Math.floor(Math.random() * quotes.length)];
document.getElementById("parag").innerHTML="<em>" + randomQuote + "</em>";
}
A break in the string is easily enough doable with the return button on your keyboard.
A break in the string that shows up in rendered HTML would require the html line break element, <br>.
Alternatively, wrapping the first part of the quote in a paragraph element (<p>) would accomplish the line break (and probably be closer to “correct” syntax).