Javascript formatting for email

Dec 31, 2020

I'm creating a list building activity based on the fine work of  Norman Lamont

I have a Javascript issue when formatting the list items for the email. The list displays correctly on the stage but the html <br> tags are not working on the formatted email message. I have searched in vain for a way to force breaks between the items that works in both places.

1 Reply
Dave Cox

Hi Robert,

You want to use the Ascii codes to embed an Carriage return and a line feed instead of a <br>.

You have the right idea in your script on slide 1.2, but the code your are using is: %0d%0a. JavaScript is case sensitive, to the correct code that you need to use is: %0D%0A. Those are two very different strings to JavaScript. 

To get the lines to format correctly, you also need to replace <br> tag with the same codes that I listed above. However, since this does not display correctly on the Storyline stage, you should do it in a new variable that you use only for the email string. 

I changed the codes in your javascript for each of the buttons for you, but I didn't add the new variables, so you will want to fix that, but you can see how I fixed the email for you in the attached file.

Dave