I have a small issue I'm running into when I try to prepopulate an email body with the contents of a div. Right now, I have a button set up that opens the email client with the information prepopulated. Everything is working perfectly, except for the fact that instead of recognizing the br as a line break, text just show up in one line with literal brs separating each "line":
Here is my code:
$(function () {
$('.SendEmail').click(function (event) {
var email = '';
var subject = 'i wrote you a poem';
var emailBody = document.getElementById("hellomessage").innerHTML;
document.location = "mailto:"+email+"?subject="+subject+"&body="+emailBody;
});
});
I think this is because, in the other function I have that populates the contents of this div, I use the following to add a line break between each line:
document.getElementById("hellomessage").innerHTML += nodes[randomNum-1].innerText;
document.getElementById("hellomessage").innerHTML += "<br>";
How can I fix this? I want the system to understand that br indicates a new line, so I can have each chunk of text show up on a new line within the body of the email.
Thank you in advance!