I have added a <div>
element to the body of my webpage using
$('body').append('<div id="itemInfo"><h2>TEST</h2></div>');
This particular <div>
is initially hidden in my CSS. I am then changing the text inside the <div>
with a function like so:
function modifyText(message) {
$('#itemInfo h2').text(message);
$('#itemInfo').fadeIn();
$('#itemInfo').fadeOut(3000);
}
To apply this function, use the following code:
modifyText("Something. ");
The issue I'm facing is that I am unable to make line breaks work within the message. How can I incorporate new line characters within the .text()
function?