Noob Question:
I have a simple switch for some static text that is set to switch at a certain interval and for some reason I cannot get the line break to work within the string. I've tried a few different methods of using \n or
and even tried encoding and it won't break the string into two sentences. Anyone see what I'm doing wrong? The text change is working. I am trying to get the string to break into a new line where the "\n" is located.
Here's a working fiddle:
Script:
var texts = ["Blah Blah"+"\n"+"Blah Blah Line two", "Over 15,000 cups of"+"\n"+"Starbucks drank daily!", "Another awesome%0D%0Aslogan here"];
var count = 0;
function changeText() {
$("#example").text(texts[count]);
count < 3 ? count++ : count = 0;
}
setInterval(changeText, 500);
Html:
<div id="Div-A"><h2><span id="example">Over 15,000 eligible<br/>dealers nationwide</span></h2></div>